ASP MVC html helpers in partial views
- by Rabbi
I am still trying to figure out how to create reusable partial views in MVC
Lets say I would like to create a partial view to display a form for submitting an address.
Then in my ViewModel I have two addresses (Home address & Work Address)
So I would think that in my view I call HTML.Partial for each one like this
@Html.Partial("Address", Model.HomeAddress)
@Html.Partial("Address", Model.WorkAddress)
but what happens is instead of the fields having names like HomeAddress.Street, HomeAddress.City etc. they just have the regular field names Street, City, etc. so the binder on the HTTPPost action has no idea what to do with them
Thanks in advance