We can easily create a one-to-one relationship between a model simple properties of simple types like int
, string
, bool
etc ... with <input>
fields and checkbox
fields in a view. Therefore, the content of those fields can be passed (or we can even keep track) back and forth between the controller and the view in POST request.
Now I have a List<MyObject>
in my model. I tried to use @Html.HiddenFor<>
to hold its or to populate it during POST but this does not do the trick.
I don't want to serialize anything. I thought ViewBag could help but ViewBag can't send data from the view to the controller (if I'm correct).
So what are the ways (beside serialization) to keep track of my model list in view and controller during POST requests ?