How to bind POST data with a model that contains multiple models (ie: a model containing multiple custom objects)?
I have a parent View that uses a few partial views. Each partial view has its own custom model. The parent View is a model containing each of the partial view's model. In other words this parent View model is NOT flat.
How do i get POST data to bind with the parent's model object? Do i have to write a custom model binder?
Update I'm not binding to a collection of objects of the same type (ie: a collection of uploaded files). I'm binding to object th开发者_JAVA百科at contains multiple of objects. For example:
public class ProductViewModel {
public ProductTreeViewModel TreeView;
public ProductDetails Details;
public ProductBreadcrumb BreadCrumb;
}
See my answer here: How to handle `PartialRender` Models?
Essentially it is all about
<input type="text" name="Doors[<%: i %>].FrontFile" id="Doors[<%: i %>].FrontFile">
Does that help?
精彩评论