title: Get checkbox values in controller mvc 4
body: <p>I am trying to retrieve the checked checkbox value from a checkbox list without any success , below is the code which i have tried:</p>
  
  <p>Model </p>
  
  <pre><code> [DisplayName("Gender")]
      public IList&lt;SelectListItem&gt; Gender { get; set; }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code> public ActionResult Index()
          {
              AssociateFormViewModel objStudentModel = new AssociateFormViewModel();
  
              List&lt;SelectListItem&gt; genderNames = new List&lt;SelectListItem&gt;();
              genderNames.Add(new SelectListItem { Text = "Male", Value = "1" });
              genderNames.Add(new SelectListItem { Text = "Female", Value = "2" });
              genderNames.Add(new SelectListItem { Text = "Prefer not to say", Value = "3" });
  
              objStudentModel.Gender = genderNames;
              return PartialView("AssociateApplicationForm", objStudentModel);
  
          }
  
  [HttpPost]
          public ActionResult HandleFormSubmit(MembershipFormViewModel model)
          {
              //model not valid, do not save, but return current umbraco page
              if (ModelState.IsValid == false)
              {
                  return CurrentUmbracoPage();
              }
   string test = "Gender: " + model.Gender + Environment.NewLine; //getting null here
   return RedirectToCurrentUmbracoPage();
  }
  </code></pre>
  
  <p>View</p>
  
  <pre><code>@foreach (var names in @Model.Gender)
                  {
                  var checkBoxId = "chk" + names.Value;
                  var tdId = "td" + names.Value;
                      &lt;table width="100%"&gt;
                          &lt;tr &gt;
                              &lt;td width="20px"&gt;
                                  &lt;input type="checkbox" id="@checkBoxId" class="chkclass" value="@names.Value" /&gt;
                              &lt;/td&gt;
                              &lt;td id="@tdId"  width="100px"&gt;
                                  @names.Text
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
  
  }
  </code></pre>
  
  <p>Any ideas where i am getting it wrong the selected checkbox value is coming null in the post action, Also how can i limit the user to select only one check box,</p>
  
  <p>Any help or suggestion will be appreciated .
  Thanks</p>