你如何从浏览访问当前的RouteData在.NET MVC? [英] How do you access the current RouteData from View in .net MVC?

查看:240
本文介绍了你如何从浏览访问当前的RouteData在.NET MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想直接从查看访问的RouteData (当前操作或参数,例如值) ,而不是将其从控制器作为传递的一部分的ViewData ,我会用什么课?


解决方案

  this.ViewContext.RouteData

应该做的伎俩。

If I want to directly access the RouteData (the current action or parameter values for example) from the View, rather than having to pass it in from the controller as part of the ViewData, what class would i use?

解决方案

this.ViewContext.RouteData

should do the trick.

这篇关于你如何从浏览访问当前的RouteData在.NET MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆