【发布时间】:2013-08-30 07:38:41
【问题描述】:
@using (Html.BeginForm("testingMethod","test",FormMethod.Get)) {
@Html.AntiForgeryToken()
@foreach (var item in Model) {
@Html.DropDownList("dropDown_"+item.ConfigCode+"_ListName", (IEnumerable<SelectListItem>)ViewData["dropDown_"+item.ConfigCode])
}
.
.
.
.
}
<input type="submit" value="Save" />
基于上面的代码,我成功调用了“testController”中的方法“testingMethod”,它返回了一个URL:
http://localhost:59512/test/testing?__RequestVerificationToken=xxxxxxx&dropDown_KKK=3
在我的 ActionResult "testingMethod" 中,我需要得到这个 dropDown_KKK 值,它是 3。我可以知道我应该在我的方法中做什么吗?我试过编辑 testingMethod 如下:
public ActionResult testing(FormCollection collection){
Debug.WriteLine(" ======= " + collection.GET("dropDown_KKK"));
}
基于其他帖子,它应该可以工作,但在 collection.GET 处发生错误,它说 System.Web.MvC.FormCollection 不包含 GET 的定义,并且没有扩展方法 'GET' 接受第一个参数 blablabla...
【问题讨论】:
标签: asp.net-mvc razor view controller actionresult