title: Checkboxes in editor template are not bound to model in post action
body: <p>I am using an editor template to display a checkbox for each role a user can be assigned to. The model is:</p>
  
  <pre><code>public class UserModel
  {
      [Required]
      [Display(Name = "User name")]
      public string UserName { get; set; }
  
      [Required]
      [DataType(DataType.EmailAddress)]
      [Display(Name = "Email address")]
      public string Email { get; set; }
  
      [Required]
      [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
      [DataType(DataType.Password)]
      [Display(Name = "Password")]
      public string Password { get; set; }
  
      [DataType(DataType.Password)]
      [Display(Name = "Confirm password")]
      [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
      public string ConfirmPassword { get; set; }
  
      public IEnumerable&lt;string&gt; UserRoles { get; set; }
  }
  public class UserRoleModel
  {
      public IEnumerable&lt;RoleViewModel&gt; AllRoles { get; set; }
      public UserModel user { get; set; }
  
      public UserRoleModel()
      {
          this.AllRoles = Roles.GetAllRoles().Select(r =&gt; new RoleViewModel
          {
              Name = r
          });
          this.user = new UserModel();
      }
  }
  public class RoleViewModel
  {
      public string Name { get; set; }
      public bool Selected { get; set; }
  }
  </code></pre>
  
  <p>The Controller:</p>
  
  <pre><code>    public ActionResult Create()
      {
          return View(new UserRoleModel());
      }
  
      [HttpPost]
      public ActionResult Create(UserRoleModel model)
      {
          if (ModelState.IsValid)
          {
              MembershipCreateStatus createStatus;
              Membership.CreateUser(model.user.UserName, model.user.Password, model.user.Email, null, null, true, null, out createStatus);
  
              if (createStatus == MembershipCreateStatus.Success)
              {
  
  
                  foreach (var r in model.AllRoles)
                  {
                      if (r.Selected)
                      {
                          Roles.AddUserToRole(model.user.UserName, r.Name);
                      }
                  }
  
                  return RedirectToAction("Index", "Home");
              }
              else
              {
                  ModelState.AddModelError("", ErrorCodeToString(createStatus));
              }
          }
  
          return View(model);
      }
  </code></pre>
  
  <p>The view:</p>
  
  <pre><code>@model BBmvc.Areas.Tools.Models.UserRoleModel
  
  
  @using (Html.BeginForm()) {
  @Html.ValidationSummary(true)
  &lt;fieldset&gt;
      &lt;legend&gt;UserModel&lt;/legend&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.user.UserName)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.user.UserName)
          @Html.ValidationMessageFor(model =&gt; model.user.UserName)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.user.Email)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.user.Email)
          @Html.ValidationMessageFor(model =&gt; model.user.Email)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.user.Password)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.user.Password)
          @Html.ValidationMessageFor(model =&gt; model.user.Password)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.user.ConfirmPassword)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.user.ConfirmPassword)
          @Html.ValidationMessageFor(model =&gt; model.user.ConfirmPassword)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(x =&gt; x.AllRoles)
      &lt;/div&gt;
  
  
      &lt;p&gt;
          &lt;input type="submit" value="Create" /&gt;
      &lt;/p&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>}</p>
  
  <p>and the editor template</p>
  
  <pre><code>    @model BBmvc.Areas.Tools.Models.RoleViewModel
  @Html.CheckBoxFor(x =&gt; x.Selected)
  @Html.LabelFor(x =&gt; x.Selected, Model.Name)
  @Html.HiddenFor(x =&gt; x.Name)
  &lt;br /&gt;
  </code></pre>
  
  <p>The problem is that no distinction is made in the post action whether any checkbox is checked or not. It seems that it is not getting bound to the model somehow.</p>