I\'m wondering how is it possible to add a CSS Class to the current page in your navigation when using ASP.NET MVC 3? Here is my navigation in my _Layout.cshtml file:
<
In my case,assume I have a Home page and a menu.
Add a ViewBag.Active
as a placeholder in Home page like this:
@{
ViewBag.Title = "Home";
ViewBag.Active = "Home";
}
Then place it to your li
class as a condition to active it or not:
-
@ViewBag.Title