---EDIT---
I have this model
public class MainModel {
string Name;
List<Address> Addresses;
}
public class Address {
string prop2;
}
Is quite easy to create the view but I didn't find a way to bind it in the POST request. I would like to avoid to loop on Request.Form
View
@foreach (var obj in Model.Address)
{
<tr>
<td>
<input type="text" id="@string.Format("obj.Name.{0}", obj.Id)" name="@string.Format("obj.Name.{0}", obj.Id)" value="@Model.Name" />
//I'm not able to overwrite the name attribute, still working on that
</td>
</tr>
}
Is there a way to automatically bind this list in the ActionController? Something like
public ActionResult Edit(MainModel model, List<Address> objects)
I suppose I have to create a custom model binding but I don't find the way to do it
... MVC make us lazy ... :)