title: How do I pass a list from a view to a controller?
body: <p>I have a view and inside I'm generating a list but I'm not being able to successfully pass it to the controller without the fields being null:</p>
  
  <p>code on my view:</p>
  
  <pre><code>@using (Html.BeginForm("AddFOP", "Revenue", null,  FormMethod.Post, new { enctype = "multipart/form-data" }))
             {
                &lt;table class="grid" style="margin-top: 15px"&gt;
                      &lt;thead&gt;
                          &lt;tr&gt;
                              &lt;th&gt;FOP&lt;/th&gt;
                              &lt;th&gt;ORGN&lt;/th&gt;
                              &lt;th&gt;PROGRAM&lt;/th&gt;
                              &lt;th&gt;PERCENTAGE&lt;/th&gt;
                              &lt;th&gt;&lt;/th&gt;
  
                          &lt;/tr&gt;
                      &lt;/thead&gt;
                      &lt;tbody&gt;               
                          @for (int i = 0; i &lt; Model.editBillingFOPList.Count;i++ )
                          { 
  
                           &lt;tr&gt;
                              &lt;td&gt;@Html.TextBox("FOPList[" + @i + "].Fund", 
                                                  Model.editBillingFOPList[i].Fund)&lt;/td&gt;
                              &lt;td&gt;@Html.TextBox("FOPList[" + @i + "].ORGN", 
                                                  Model.editBillingFOPList[i].ORGN)&lt;/td&gt;
                              &lt;td&gt;@Html.TextBox("FOPList[" + @i + "].Program", 
                                                  Model.editBillingFOPList[i].Program)&lt;/td&gt;
                              &lt;td&gt;@Html.TextBox("FOPList[" + @i + "].Percentage", 
                                                  Model.editBillingFOPList[i].Percentage)&lt;/td&gt;
                          &lt;/tr&gt;
  </code></pre>
  
  <p>this is the controller:</p>
  
  <pre><code>[HttpPost]
          public ActionResult AddFOP(List&lt;BillingFOPModel&gt; FOPList)
          {
  
  
              return View();
          }
  </code></pre>
  
  <p>my FOPList shows a count of 1 and if I expand it on debug mode it shows the list of the model but with null values - any thoughts?</p>
  
  <p>My Model:</p>
  
  <pre><code> public class BillingFOPModel
      {
          public string BillingArea;
          public string BillingAreaName;
          public string Fund;
          public string ORGN;
          public string Program;
          public string Percentage;
      }
  </code></pre>
  
  <p>This my ViewModel:</p>
  
  <pre><code>  public class EditBillingViewModel
          {   //declare attributes
  
              public List&lt;BillingFOPModel&gt; editBillingFOPList { get; set; }
              public string newBillingArea { get; set; }
              public string newBillingAreaName { get; set; }
              public string newFund { get; set; }
              public string newORGN { get; set; }
              public string newProgram { get; set; }
              public string newPercentage { get; set; }
  
              public EditBillingViewModel()
              {
  
              }
  
              //constructor that passes a list and 2 strings
              public EditBillingViewModel(List&lt;BillingFOPModel&gt; editBillingFOPList, string newBillingArea, string newBillingAreaName)
              {
                  this.editBillingFOPList = editBillingFOPList;
                  this.newBillingArea = newBillingArea;
                  this.newBillingAreaName = newBillingAreaName;
              }
  </code></pre>