How do you access the current RouteData from View in .net MVC?

孤街浪徒 提交于 2019-11-29 02:03:32

问题


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?


回答1:


this.ViewContext.RouteData

should do the trick.



来源:https://stackoverflow.com/questions/1134776/how-do-you-access-the-current-routedata-from-view-in-net-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!