• ASP.NET MVC的 ActionResult跳转视图方法


    action跳转分类

    一、在同一控制器(Controllers)下的action跳转(不带参) 1.return Redirect(“Index”);Index本controller下,ActionResult的方法名称 2.return View(“Index”); *直接显示对应的页面Index * 3.return View() ; 4.RedirectToAction(“Index”);。 二、在同一控制器(Controllers)下的action跳转(带参) 1.Response.Redirect(“Index?id=1”);//适用于本controller下的方法名称,可带参数。 Index?:ActionResult的方法名;id=1:参数和内容 * 三、跳转到不同控制器(Controllers)下的action(不带参) 1.RedirectToAction(ActionName,ControllerName) ActionName :ActionResult的方法名; ControllerName:控制器的名字 2.RedirectToRoute(new {controller=“Home”,action=“Index”}); Index :ActionResult的方法名; Home:控制器的名字 四、跳转到不同控制器(Controllers)下的action(带参) 1.RedirectToRoute(new {controller=“Home”,action=“Index”, id=param});/ Index :ActionResult的方法名; Home:控制器的名字; id=param:参数和内容
  • 相关阅读:
    《大道至简》读后笔记_3
    学习进度表_十周
    《大道至简》读后笔记_2
    《大道至简》读后笔记_1
    《梦断代码》读后笔记_3
    《梦断代码》读后笔记_2
    学习进度表_九周
    《梦断代码》读后笔记_1
    小组评价
    团队效绩计划
  • 原文地址:https://www.cnblogs.com/qingjiawen/p/14714559.html
Copyright © 2020-2023  润新知