title: MVC 4 Passing a list from a view to a controller
body: <p>I'm new to MVC ASP and would need your assistance.
  I would like to pass a list from a view to controller but each time I submit my form, the list is empty (null) in the controller.</p>
  
  <p>Here is my model:</p>
  
  <pre><code>namespace ArcheryComp.Models
     {
      [MetadataType(typeof(Participe))]
      public class Participe
      {
  
          [Required]
          [Display(Name = "Id Archer")]
          public int idArcher { get; set; }
          [Required]
          [Display(Name = "Id Tournoi")]
          public int IdTournament { get; set; }
          [Required]
          [Display(Name = "Division")]
          public int division { get; set; }
          [Required]
          [Display(Name = "Categorie")]
          public string categorie { get; set; }
          [Required]
          [Display(Name = "Score 1")]
          public int ArchScore1 { get; set; }
  
          [Display(Name = "X")]
          public int ArchScore1_X_6 { get; set; }
  
          [Display(Name = "10")]
          public int ArchScore1_10_5 { get; set; }
          [Required]
          [Display(Name = "Score 2")]
          public int ArchScore2 { get; set; }
  
          [Display(Name = "X")]
          public int ArchScore2_X_6 { get; set; }
  
          [Display(Name = "10")]
          public int ArchScore2_10_5 { get; set; }
          [Required]
          [Display(Name = "Total")]
          public int ArchTotalScore { get; set; }
  
          [Display(Name = "Total X")]
          public int ArchTotalScore_X_6 { get; set; }
  
          [Display(Name = "Total 10")]
          public int ArchTotalScore_10_5 { get; set; }
  
          public List&lt;Participe&gt; liste { get; set; }
      }
     }
  </code></pre>
  
  <p>Here is my controller: </p>
  
  <pre><code>namespace ArcheryComp.Controllers
     {
      public class ParticipeController : Controller
      {
          private ArcheryCompEntities db = new ArcheryCompEntities();
         ......
         [HttpPost]
          [ValidateAntiForgeryToken]
          public ActionResult EncodeResult(IList&lt;Participe&gt; parti)
  
          {
  
              foreach (Participe item in parti)
              {
  
  
                  var data = from part in db.Participe
                             where part.IdArcher == item.IdArcher &amp;&amp;  part.IdTournament == item.IdTournament
                             select part;                    
  
                  item.ArchScore1 = item.ArchScore1;
                  item.ArchScore2 = item.ArchScore2;
                  item.ArchTotalScore = item.ArchTotalScore;
              }
  </code></pre>
  
  <p>And here is my view :</p>
  
  <pre><code>    @model List&lt;ArcheryComp.Participe&gt;
  
     @{
      ViewBag.Title = "EncodeResult";
     }
  
  
      &lt;h2&gt;Encoder Resultats&lt;/h2&gt;
  
  
      @using (Html.BeginForm("EncodeResult","Participe",FormMethod.Post)) 
     {
      @Html.AntiForgeryToken()
      @Html.ValidationSummary(false)
      &lt;table&gt;
          &lt;tr&gt;
              &lt;th&gt;
                  @Html.LabelFor(model =&gt; Model[0].Archers.Nom)
              &lt;/th&gt;
              &lt;th&gt;
                  @Html.LabelFor(model =&gt; Model[0].Archers.Prenom)
              &lt;/th&gt;
              &lt;th&gt;
                  @Html.LabelFor(model =&gt; Model[0].Divisions.DivDescription)
              &lt;/th&gt;
              &lt;th&gt;
                  @Html.LabelFor(model =&gt; Model[0].Categorie)
              &lt;/th&gt;
              &lt;th&gt;
                  @Html.LabelFor(model =&gt; Model[0].ArchScore1, new {style =  "width: 10px;"})
              &lt;/th&gt;
              &lt;th&gt;
                  @Html.LabelFor(model =&gt; Model[0].ArchScore2, new {style = "width: 10px;"})
              &lt;/th&gt;
              &lt;th&gt;
                  @Html.LabelFor(model =&gt; Model[0].ArchTotalScore, new {style = "width: 10px;"})
              &lt;/th&gt;
          &lt;/tr&gt;
          @for(int i = 0; i &lt; Model.Count() ; i++)
          {
              &lt;tr&gt;
                  &lt;td&gt;                                        
                      @Html.TextBox("archers["+@i+"].IdArcher",  Model[i].Archers.Nom)
                      @Html.ValidationMessageFor(x =&gt; x[i].IdArcher)
                  &lt;/td&gt;
                  &lt;td&gt; 
                      @Html.TextBox("archers["+@i+"].Prenom", Model[i].Archers.Prenom)
                  &lt;/td&gt; 
                   &lt;td&gt;
                       @Html.TextBox("archers["+@i+"].Division", Model[i].Divisions.DivDescription)
                       @Html.ValidationMessageFor(x =&gt; x[i].Divisions.Id)
  
                  &lt;/td&gt; 
                  &lt;td&gt;
                       @Html.TextBox("archers["+@i+"].Categorie", Model[i].Categorie)
                      @Html.ValidationMessageFor(x =&gt; x[i].Categorie)
                  &lt;/td&gt;
                   &lt;td&gt; 
                      @Html.TextBox("suma["+@i+"]", Model[i].ArchScore1,  new{  @onchange = "updatesum()"})
                      @Html.ValidationMessageFor(x =&gt; x[i].ArchScore1)
                  &lt;/td&gt; 
                  &lt;td&gt;&gt;
                      @Html.TextBox("sumb["+@i+"]", Model[i].ArchScore2, new { @onchange = "updatesum()" })
                      @Html.ValidationMessageFor(x =&gt; x[i].ArchScore2)
                  &lt;/td&gt;
                  &lt;td&gt; 
                      @Html.TextBox("sumt["+@i+"]", Model[i].ArchTotalScore, new { @onchange = "updatesum()" })
                      @Html.ValidationMessageFor(x =&gt; x[i].ArchTotalScore)
                  &lt;/td&gt; 
              &lt;/tr&gt;
          }
  
      &lt;/table&gt;
      &lt;p&gt;
          &lt;input type="submit" value="Save" /&gt;
      &lt;/p&gt;
     }
  </code></pre>
  
  <p>Can you please help sort this out ? 
  Many thanks in advance !!!</p>