加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

ASP.NET MVC在httpPost之后返??回Index视图

发布时间:2020-12-16 09:19:34 所属栏目:asp.Net 来源:网络整理
导读:我在同一个控制器中创建了两个视图.问题是,我想在完成httppost后加载第二个视图. 索引视图 public ActionResult Index(){ return View();} HttpPost [HttpPost]public ActionResult Index(AccountModel model){ return View("NEXTVIEW");} 下一个视图 public
我在同一个控制器中创建了两个视图.问题是,我想在完成httppost后加载第二个视图.

索引视图

public ActionResult Index()
{
  return View();
}

HttpPost

[HttpPost]
public ActionResult Index(AccountModel model)
{

  return View("NEXTVIEW");

}

下一个视图

public ActionResult NEXTVIEW(EpmloyeeModal model)
{
  return View();
}

在HttpPost之后,我添加了返回nextview.而它总是返回索引视图.我试图在不同的网站上找到这样的场景,但在任何地方都找不到.

谢谢.

解决方法

试试这样吧

[HttpPost]
public ActionResult Index(AccountModel model)
{
  return RedirectToAction("NEXTVIEW");
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读