When you create a new MVC project it creates a Site.master with the following markup:
<div id="menucontainer">
<ul id="menu">
<li><%: Html.ActionLink("Home", "Index", "Home")%></li>
<li><%: Html.ActionLink("About", "About", "Home")%></li>
</ul>
</div>
I would like to put code in here that will highlight the current link if I am on that page.
If I add another link such as:
<li><%: Html.ActionLink("Products", "Index", "Products")%></li>
I would want the Products link to be active (using a css class like .active) if I'm on any action in the Products controller.
The About link should be active if I'm on the HomeController About action. The Home link should be active if I'm on the Index action of the HomeController.
What is the best way to do this in MVC?