It\'s a simple question. How did stackoverflow do their menu in Asp.net MVC, with highlight on what page we are on.
The best way - create MVC helper (see previous answers) But if you don't want to do it and want to do quickly - remember about new feature in MVC 4.0 with set attributes of html tags (attribute will be avoid if it's set to null):
@{
string currentAction = ViewContext.RouteData.Values["action"].ToString().ToLower();
string classUpcomingTime = null;
string classArchive = null;
string classReporting = null;
switch (currentAction)
{
case "upcomingtime":
classUpcomingTime = "active";
break;
case "archive":
classArchive = "active";
break;
case "reporting":
classReporting = "active";
break;
}
}