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

1

54

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?

Goodale answered 16/7, 2009 at 0:13 Comment(0)
S
101
this.ViewContext.RouteData

should do the trick.

Sussna answered 16/7, 2009 at 0:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.