title: MVC3 How To Bind Multiple Checkboxes to 1 Property in ViewModel
body: <p>I need to display a list of checkboxes, which more than one can be checked.</p>
  
  <p>When the user hits submit, the value of these checkboxes need to go into a property in the ViewModel...this is what I got so far...</p>
  
  <pre><code>public class RegisterModel
  {
      public List&lt;string&gt; Roles { get; set; }
      public List&lt;RoleModel&gt; SelectedRoles { get; set; }    
  }
  public class RoleModel
  {
      public string RoleName { get; set; }
  }
  </code></pre>
  
  <p>In the view I am trying to do this...</p>
  
  <pre><code>@foreach (var role in Model.Roles)
  {
      @Html.CheckBoxFor(m =&gt; m.SelectedRoles, role.RoleName)@role.RoleName
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>CS0029: Cannot implicitly convert type 'System.Collections.Generic.List&lt;string&gt;' to 'bool'
  </code></pre>
  
  <p>Can someone tell me what I'm doing wrong?</p>