Created
October 25, 2010 21:43
-
-
Save mimetaur/645842 to your computer and use it in GitHub Desktop.
C# helper to return the controller name, action name, and a combination of the two (based on haml's page_class helper)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string PageCssClass(this HtmlHelper helper, string seperator="-") | |
{ | |
string names = String.Format("{0} {1} {0}{2}{1}", | |
helper.ViewContext.RouteData.Values["Controller"], | |
helper.ViewContext.RouteData.Values["Action"], | |
seperator); | |
return names.ToLower(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment