Search
Learn
Share

Get the Controller Name in MVC Razor Custom HTML Helper

Published by Profile Image DevDashboard on 17 December, 2015
387 views
public static MvcHtmlString MyCustomHelper(this HtmlHelper htmlHelper, string text)
{
string controllerName = htmlHelper.ViewContext.RouteData.Values["controller"].ToString();

//YOUR CODE
}