Wednesday, 11 September 2013

submit model with RenderPartial on View

submit model with RenderPartial on View

So imagine this:
There is a View. There is a model with this view in the following form:
Id
List<Food>
within each Food, there is:
Id
Name
List<Ingredients>
each ingredient contains:
Id
Name
Qty
This is in 1 model.
I have a view which takes in this Model. I then have a partial view which
takes in the List and renders it on the screen. That works however when
the form is submitted (the button is on the main view), the data fails to
bind/is not shown in the Model.
what is the correct way to be able to bind the data back?
it does work when I take the whole thing and put it in the main view
itself but due to reusability reasons, it makes sense having it in a
partial view so I can just "drop" it on any page and pass the data.
Thanks

No comments:

Post a Comment