title: Create a checkbox ist control by extending html helper in mvc 3?
body: <p>I am trying to create a dynamic checkboxlist control with an extended html helper? The radio button list will be filled by a list of items? Not sure how to make this more flexible for any list items. </p>
  
  <pre><code>public static string CheckBoxList(this HtmlHelper helper, string name, &lt;Some List&gt; items)
          {
              var output = new StringBuilder();
              output.Append(@"&lt;div class=""checkboxList""&gt;");
  
              foreach (var item in items)
              {
                  output.Append(@"&lt;input type=""checkbox"" name=""");
                  output.Append(name);
                  output.Append("\" value=\"");
                  output.Append(item.Value);
                  output.Append("\"");
  
                  output.Append(" /&gt;");
                  output.Append(item.Value);
                  output.Append("&lt;br /&gt;");
              }
  
              output.Append("&lt;/div&gt;");
  
              return output.ToString();
          }
  </code></pre>