Created
May 22, 2012 22:09
-
-
Save motowilliams/2771978 to your computer and use it in GitHub Desktop.
li helper to look at the requested route and add a 'selected' css class to the li tag
This file contains hidden or 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
@helper ItemBuild(string menuItemText, string controllerName, string actionName){ | |
var controller = ViewContext.Controller.ValueProvider.GetValue("controller").RawValue; | |
var action = ViewContext.Controller.ValueProvider.GetValue("action").RawValue; | |
<li @(controller.Equals(controllerName) && action.Equals(actionName) ? "class=selected" : string.Empty)>@Html.ActionLink(menuItemText, actionName, controllerName)</li>} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment