-4

我有带有数据的 webgrid,每一行都有“添加”按钮,如何将这一行中的数据添加到我可以发送到控制器的 viewbag 或列表中?

4

1 回答 1

0

There are some ways to do this. One of them is using Formcollection

<input type="input" name="myData[1]"/>
<input type="input" name="myData[2]"/>

and on controller you can do:

[httpPost]    
public ActionResult myController(FormCollection form)
{
    var myData1 = form["myData[1]"];    
    var myData2 = form["myData[2]"];    
}
于 2013-08-28T17:02:21.013 回答