本文介绍了httpPost之后,ASP.NET MVC返回索引视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在同一控制器中创建了两个视图.问题是,我想在httppost完成后加载第二个视图.
I have created a two views in same controller. the issue is, i want to load second view after httppost is done.
索引视图
public ActionResult Index()
{
return View();
}
HttpPost
[HttpPost]
public ActionResult Index(AccountModel model)
{
return View("NEXTVIEW");
}
下一个视图
public ActionResult NEXTVIEW(EpmloyeeModal model)
{
return View();
}
在HttpPost之后,我添加了返回nextview的功能.而它总是返回索引视图.我试图在其他网站上找到这种情况,但找不到任何地方.
After HttpPost, I have added return to nextview. whereas it always return back to Index view. I tried to find such scenario on different websites, but could not find anywhere.
谢谢.
推荐答案
尝试这样
[HttpPost]
public ActionResult Index(AccountModel model)
{
return RedirectToAction("NEXTVIEW");
}
这篇关于httpPost之后,ASP.NET MVC返回索引视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!