Model binding for a ViewModel containing multiple objects
问题 I have a strongly typed view of type ProductListingViewModel which in turn contains a ProductViewModel. (both custom view models). I have some form elements on my page and these are created like so: <%: Html.DropDownListFor(m => m.ProductViewModel.CategoryId, Model.Categories)%> which generates the HTML: <select name="ProductViewModel.CategoryId" id="CategoryId"> With the default model binding I expected that when I post to my controller action which accepts a parameter of type