title: How to bind MVC checkboxes to model
body: <p>I have a view which outputs a list of questions. The user will select questions they want included in a report and then submit the form.</p>
  
  <p>My view looks like:</p>
  
  <pre><code>@using (Html.BeginForm("Step6", "Home", FormMethod.Post))
  {
    @Html.HiddenFor(m =&gt; m.EventID)
    @Html.HiddenFor(m =&gt; m.CompanyID)
    foreach (var item in Model.Questions)
    {
        &lt;div class="checkbox"&gt;
        &lt;input type="checkbox" id="@item.QuestionID" name="QuestionIds" value="@item.Title" /&gt;
        &lt;label for="@item.QuestionID"&gt;@item.Title&lt;/label&gt;
        &lt;/div&gt;
    }
    &lt;p&gt;&lt;input type="submit" class="btn btn-primary" value="Submit" /&gt;&lt;/p&gt;
  }
  </code></pre>
  
  <p>Generated HTML looks like:</p>
  
  <pre><code>&lt;div class="checkbox"&gt;
      &lt;input type="checkbox" id="12" name="QuestionIds" value="Would you like an account manager to contact you?" /&gt;
      &lt;label for="12"&gt;Would you like an account manager to contact you?&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="checkbox"&gt;
      &lt;input type="checkbox" id="13" name="QuestionIds" value="Comments - please be as detailed as possible." /&gt;
      &lt;label for="13"&gt;Comments - please be as detailed as possible.&lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Question collection:</p>
  
  <pre><code>public class Question
  {
      public Guid QuestionID { get; set; }
      public string Title { get; set; }
  }
  </code></pre>
  
  <p>Controller action</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Step6(Models.EventCompanyQuestionnaireQuestions model)
      {
          return View();
      }
  </code></pre>
  
  <p>The model:</p>
  
  <pre><code>public class EventCompanyQuestionnaireQuestions
  {
      public int EventID { get; set; }
      public int CompanyID { get; set; }
      public List&lt;Guid&gt; QuestionIds { get; set; }
  }
  </code></pre>
  
  <p>When the form is submitted the List is an empty, initialized list. The rendered form element is named QuestionIds which matches the model. I need QuestionIds to have the checked checkboxes.</p>