开发者

asp.net mvc2 - update list of objects

开发者 https://www.devze.com 2023-01-02 23:01 出处:网络
I want to display list of objects from database, and on the same page have option to edit them. When submitting, I\'d like to submit changes to all of them.

I want to display list of objects from database, and on the same page have option to edit them. When submitting, I'd like to submit changes to all of them. I found this link: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx and http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysLists开发者_Go百科CollectionsDictionaries.aspx but there is no description how to handle posted data in controller.

Thanks in advance!


You could try something like this in you controller to catch the post

[HttpPost]
public ActionResult YourFunction()
{
//some foo
}

Just as the httppost attribute in mvc you also can use the httpget attribute to catch a get action in your controller. Then the controller can do whatever you want to do with it. I'm not sure if this is exactly what you need but i hope it helps.

0

精彩评论

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