title: pass list of objects from view to controller in asp.net
body: <p>I am adding checkboxes to every object in a List. When I try to return the values back to the controller the list is empty and I only get the checkbox bool.</p>
  
  <p>Can someone explain to me how to pass the List correctly from the view to the controller.</p>
  
  <p>I tried it with form but I am not sure if this is the correct way.</p>
  
  <p>I searched a lot on Google and also found similar posts on stackoverflow but I couldn't find one that helped me. </p>
  
  <p><strong>View</strong></p>
  
  <pre><code>@model List&lt;WCFasp.net.WCF.Person&gt; 
  @{
      ViewBag.Title = "ShowView";
  }
  
  @using (Html.BeginForm("Check", "Home"))
  {
          for (int i = 0; i &lt; Model.Count(); i++)
          {
          &lt;p&gt;@Html.CheckBoxFor(m =&gt; m[i].IsChecked) @Html.DisplayFor(m =&gt; m[i].Name)&lt;/p&gt;
          }
          &lt;input id="submit" type="submit" value="submit" /&gt;
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>[HttpPost]
          public ActionResult Check(List&lt;WCF.Person&gt; selectedpersonlist)
          {
              //Here I get the empty list
  
              return View("ShowSelectedView");
          }
  </code></pre>
  
  <p><strong>Person</strong></p>
  
  <pre><code>[DataContract]
      public class Project
      {
          [DataMember]
          public string Name { get; set; }
          [DataMember]
          public bool IsChecked { get; set; }
  
          public Project(string name, bool isChecked)
          {
              this.Name = name;
              this.IsChecked = isChecked;
          }
      }
  </code></pre>
  
  <p><em>Little question at the end. Am I getting down voted because I am not a pro or is there another reason?</em></p>