ASP.NET MVC - Unable to bind form values to List<Model>

Au98stin

New Member
I have this model\[code\] public class ItemClassification { public int ItemID {get; set;} public string ItemName {get; set;} }\[/code\]and I have this form\[code\] <form method="POST" action="/Home/UpdateItemClassifications"> <table> <tr> <th>Item ID</th> <th>Item Name</th> </tr> <tr> <td> <input name="ItemClassification[0].ItemID" value="http://stackoverflow.com/questions/15590774/1"/> </td> <td> <input name="ItemClassification[0].ItemName" value="http://stackoverflow.com/questions/15590774/Item One"/> </td> </tr> <tr> <td> <input name="ItemClassification[1].ItemID" value="http://stackoverflow.com/questions/15590774/2"/> </td> <td> <input name="ItemClassification[1].ItemName" value="http://stackoverflow.com/questions/15590774/Item Two"/> </td> </tr> <tr> <td> <input name="ItemClassification[2].ItemID" value="http://stackoverflow.com/questions/15590774/3"/> </td> <td> <input name="ItemClassification[2].ItemName" value="http://stackoverflow.com/questions/15590774/Item Three"/> </td> </tr> </table> </form>\[/code\]And I'm trying to bind these values to this controller action to loop through them and update them in the db.\[code\] [HttpPost] public ActionResult UpdateItemClassifications(List<ItemClassification> UpdatedClassifications) { //save logic here.. }\[/code\]For whatever reason I am not getting my posted form values bound to the ItemClassification model. Any help or direction would be appreciated. I have tried posting this form with only 1 set of values and removed the "List<>" from the controller and it mapped the values correctly.
 
Back
Top