title: Postback checkboxes from table rows on MVC Razor Strongly Typed View
body: <p>I have strongly typed view showing data from </p>
  
  <pre><code>ViewModel 
      public class GoldSetnUsers
      {
       bool Public { get; set; }
       public List&lt;GSUsers&gt; gsUsers { get; set; }
  
  
          public GoldSetnUsers()
          {
              UsersContext _dbm = new UsersContext();
              this.gsUsers = _dbm.UserProfiles.Select(n =&gt; new GSUsers { UserName = n.UserName, isEditor = false, isReviewer = false }).ToList();
          }
  
          public class GSUsers
          {
              public string UserName { get; set; }
              public bool isEditor { get; set; }
              public bool isReviewer { get; set; }
          }
  
      }
  </code></pre>
  
  <p>Controller Httpget method display this view</p>
  
  <p><img src="https://i.stack.imgur.com/icz6v.png" alt="enter image description here"></p>
  
  <p>Problem is, post-back model returns all rows check boxes as false. The check-box outside table, Public, returns correct post-back value though.</p>
  
  <p>Controller Postback code</p>
  
  <pre><code>[HttpPost]
      public ActionResult Create(GoldSetnUsers newGS)
      {
          if (ModelState.IsValid)
          {   // newGS gets me value 
  
            }
  </code></pre>
  
  <p>}</p>
  
  <p>View</p>
  
  <pre><code>@model mvc2db.Models.GoldSetnUsers
  @using BootstrapSupport;
  @using (Html.BeginForm()) {
      @Html.ValidationSummary(true)
  
  
           @Html.BeginControlGroupFor(model=&gt;model.Public)
              @Html.LabelFor(model =&gt; model.Public,new {@class="control-label"})
          &lt;div class="controls"&gt;
              @Html.EditorFor(model =&gt; model.Public,new {@class="input-xlarge"})
              @Html.ValidationMessageFor(model =&gt; model.Public,null,new{@class="help-inline"})
          &lt;/div&gt;
          &lt;div class="controls"&gt;
              &lt;table class="table"&gt;
      &lt;thead&gt;
      &lt;tr&gt;
  
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Reviewer&lt;/th&gt;
                  &lt;th&gt;Editor&lt;/th&gt;
  
      &lt;/thead&gt;
      &lt;tbody&gt;
  
  @foreach (var item in Model.gsUsers) {
      &lt;tr&gt;
  
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.UserName)
          &lt;/td&gt;
  
          &lt;td&gt;
              @Html.EditorFor(modelItem =&gt; item.isEditor)
          &lt;/td&gt;
  
          &lt;td&gt;
              @Html.EditorFor(modelItem =&gt; item.isReviewer)
          &lt;/td&gt;
  
  
  
      &lt;/tr&gt;
  }
  &lt;/tbody&gt;
  &lt;/table&gt;&lt;/div&gt;
  @Html.EndControlGroup()
  
      &lt;div class="form-actions"&gt;
              &lt;button type="submit" class="btn btn-primary"&gt;Save changes&lt;/button&gt;
              &lt;button class="btn"&gt;Cancel&lt;/button&gt;
            &lt;/div&gt;
      &lt;/fieldset&gt;
  }
  </code></pre>