1

I have an MVC View User Control and from with Controller I would like to find out what the name of the controller that the MVC View User Control has been called from.

Hope that makes sense?

Coppermill
  • 6,676
  • 14
  • 67
  • 92
  • http://stackoverflow.com/questions/1083774/getting-the-name-of-the-controller-and-action-method-in-the-view-in-asp-net-mvc OR http://stackoverflow.com/questions/1116294/better-way-to-find-controller-name-from-masterpage-view-in-asp-net-mvc – eu-ge-ne Jul 20 '09 at 10:55

1 Answers1

2

This should do it :

<%=ViewContext.RouteData.Values["controller"] %>
Çağdaş Tekin
  • 16,592
  • 4
  • 49
  • 58