我尝试发送一个参数submit
按钮后行动,以便有我的样本:
@using(Html.BeginForm(actionName: "Search", controllerName: "MyController", routeValues: new { rv = "102" })) {
...
<input type="submit" value="Search" />
}
这是我的搜索行动:
[HttpPost]
public virtual ActionResult Search(string rv, FormCollection collection) {
...
}
所以,每一件事情是罚款,直至现在,
然后我尝试发送一个复杂的对象像Dictionary<string, string>
所以,你可以只需更换string
型rv
与参数Dictionary<string, string>
并发送一个字典,但在这种情况下, rv
值始终会返回一个字典,0计数? 问题出在哪儿? 我怎么能发送一本字典后行动?
更新
我也尝试这种之一,但尚未制定(平均RV钢是0计数的字典):
@using(Html.BeginForm(actionName: "Search", controllerName: "MyController", routeValues: new { rv = Model.MyDictionary }, method: FormMethod.Post, htmlAttributes: new { @class = "FilterForm" })) {
...
}
[HttpPost]
public virtual ActionResult Search(Dictionary<string, string> rv, FormCollection collection) {
...
}