[英]How to redirect from an action to another action but provide its parameters in MVC 3?
I know that you can make a redirection from an action to another like: 我知道您可以从一个动作重定向到另一个动作,例如:
public ActionResult Index() {
return View();
}
public ActionResult OtherAction(){
return RedirectToAction("Index");
}
Good. 好。 I didn't found a solution to my question: How to redirect to an action which has parameters ?
我没有找到以下问题的解决方案:如何重定向到具有参数的操作? For example:
例如:
public ActionResult Index(string v1, int i1) {
return View();
}
public ActionResult OtherAction(string value, int size){
return RedirectToAction("Index", // here need some adjustements or another trick);
}
Sorry for bad question but I didn't find any related questions here, maybe I don't know to use search :) 不好意思,但我在这里没有找到任何相关的问题,也许我不知道要使用搜索:)
使用RedirectToAction的重载之一,该重载采用RouteValues对象,例如
return RedirectToAction("Index", "Controller", new {v1 = "Hello", i1 = 123});
return RedirectToAction("Index", new {v1 = value1,i1=value2} );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.