【发布时间】:2012-04-17 09:46:57
【问题描述】:
当我提交表单时,我有 2 个索引操作 Post 和 Get,Post Action 返回:
return RedirectToAction("Index");
编辑:
我的get Index Action可以获取一些参数来支持搜索和过滤返回的List。像这样:
public ActionResult Index(string search = "", long searchItem = 0, long RC = 0, long Page = 1)
我使用了分页列表,并且有一个 DropDownList 显示每页中的行数,我编写了一个 jquery 脚本来更改此下拉表单。提交和提交表单时
在RedirectTAction 我丢失了以下代码的参数:
[HttpPost]
public ActionResult Index(FormCollection collection, string search = "") {
long RowCount = 0;
long.TryParse(string.Format("{0}", collection["RowCount"]), out RowCount);
//More implement
return RedirectToAction("Index", new { RC = RowCount, search = search, searchItem = Id });
那么有没有办法在 Post Action 中获取 Url 或 url 参数?在这种情况下你有什么建议?
【问题讨论】:
-
什么url参数?通常当您 POST 时没有查询字符串参数。或者你的情况有吗?您是在谈论查询字符串参数或路由值还是 POST 值?
-
@DarinDimitrov 我更新问题
标签: asp.net-mvc asp.net-mvc-3 url razor http-post