开发者

Posting lists in your model back to the controller

开发者 https://www.devze.com 2023-03-04 20:35 出处:网络
I have not been able to find a good example of a model that contains a list that you pass to your view, then pass it back to the controller when the user posts.I have lots of examples of passing back

I have not been able to find a good example of a model that contains a list that you pass to your view, then pass it back to the controller when the user posts. I have lots of examples of passing back a 'selected' item in a listboxfor, but no example where I can persist the entire list in the model back to the controller.

I have searched far and wide and have come up short. If someone can point me to a good example, I would greatly a开发者_JS百科ppreciate it.


You need to make sure your items are in inputs that will get posted back to the server and in sequential order - see: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx

Also - you could retrieve your own objects and send them over in a call to jQuery.post as your data parameter as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号