Wednesday, September 24, 2014

Get the name of the current Controller in Razor markup.

@HttpContext.Current.Request.RequestContext.
      RouteData.Values["controller"].ToString()

Bonus: If you use "action" instead of "controller" it does what you'd expect.

No comments:

Post a Comment