Gene Reddick
Gene Reddick

Reputation: 4655

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

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?

Upvotes: 54

Views: 19438

Answers (1)

womp
womp

Reputation: 116977

this.ViewContext.RouteData

should do the trick.

Upvotes: 101

Related Questions