Tuesday, 27 August 2013

MVC4: nested partial-view loses model data

MVC4: nested partial-view loses model data

In an MVC4 project im using a partial View thats using a ViewModel and has
a GET Form on it. In the Controller action i expect the ViewModel object
with some data. When this partial is placed on a normal (.cshtml) View, i
recieve the data via the expected ViewModel object in the Controller
action. But, When this partial is placed on another partial view, for some
reason the ViewModel object in the controller action is empty. When i step
through the creation of the HttpGet-form, the passed-in model is not
empty, but when the GET controller action is called, the model is.
Anyone know the reason for this? Is this some MVC behavior i don't know
about maybe? Thanks!

No comments:

Post a Comment