public static string GetCurrentView(this HtmlHelper helper)
{
string controller = helper.ViewContext.RouteData.GetRequiredString("controller");
string view = helper.ViewContext.RouteData.GetRequiredString("action");
return controller + "_" + view;
}
Ex : string currentView = Html.GetCurrentView();
Sunday, January 30, 2011
Finding the Current View in ASP.NET MVC
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment