MVC View中获取action、controller、area名称
来源:互联网 发布:nginx php fpm 配置 编辑:程序博客网 时间:2024/06/16 09:54
获取控制器名称:
ViewContext.RouteData.Values["controller"].ToString();
获取Action名称:
ViewContext.RouteData.Values["action"].ToString();
获取路由参数值:
ViewContext.RouteData.Values[名称].ToString();
如:ViewContext.RouteData.Values["ID"].ToString(); 获取ID的值
获取area名称
在代码中:
ControllerContext.RouteData.DataTokens["area"]
在View中:
ViewContext.RouteData.DataTokens["area"]
具体代码
var action = ViewContext.RouteData.Values["Action"].ToString().ToLower();
var controllerName = ViewContext.RouteData.Values["controller"].ToString().ToLower();var areaName = ViewContext.RouteData.DataTokens["area"].ToString().ToLower();
0 0
- MVC View中获取action、controller、area名称
- MVC View中获取action、controller、area名称
- MVC View中获取action、controller、area名称、参数
- MVC中获取当前URL、controller、action
- MVC中如何获取当前action、controller
- 获取当前URL、area、controller、action
- .net mvc 获取url中controller和action
- 在ASP.NET MVC 中获取当前URL、controller、action
- .net mvc 获取url中controller和action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- ASP.NET MVC 中 当前controller、action的获取
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- .net mvc 获取url中controller和action
- Kali 2.0 RTL8192eu驱动安装(记录贴)
- 使用intel ijl库 RGB转Jpg
- 《Android开发精要》读书笔记——Android应用模型
- UVA 11462(p39)----Age Sort
- iOS中的正则表达式
- MVC View中获取action、controller、area名称
- JAVA生产者消费者的实现
- Android中的消息机制Handler、Message、Looper之间关系
- jitter buffer QoS的解决方案
- iOS开发系列--IOS程序开发概览
- js关闭弹出window
- 【nginx】新手指南
- Java中的同步与死锁
- PL/SQL之触发器谓词