public static string MenuParentDisplay(this HtmlHelper htmlHelper, SiteMapNodeModelList nodes) { var currentAction = htmlHelper.ViewContext.RouteData.GetRequiredString("action"); var currentController = htmlHelper.ViewContext.RouteData.GetRequiredString("controller"); var exists = nodes.Any(c => (string.Equals(c.Action, currentAction) && string.Equals(c.Controller, currentController))); return(exists ? "block" : "none"); }