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

asp.net MvcRoutedata

asp.net Mvc Problem Overview


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?

asp.net Mvc Solutions


Solution 1 - asp.net Mvc

this.ViewContext.RouteData

should do the trick.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGene ReddickView Question on Stackoverflow
Solution 1 - asp.net MvcwompView Answer on Stackoverflow