When you create a new MVC project it creates a Site.master with the following markup:
Here is a way to implement this as an MVC helper:
@helper NavigationLink(string linkText, string actionName, string controllerName)
{
if(ViewContext.RouteData.GetRequiredString("action").Equals(actionName, StringComparison.OrdinalIgnoreCase) &&
ViewContext.RouteData.GetRequiredString("controller").Equals(controllerName, StringComparison.OrdinalIgnoreCase))
{
@linkText
}
else
{
@Html.ActionLink(linkText, actionName, controllerName);
}
}
It can then be used similar to the following:
@NavigationLink("Home", "index", "home")
@NavigationLink("About Us", "about", "home")
A good article on MVC helpers can be found here: http://weblogs.asp.net/scottgu/archive/2011/05/12/asp-net-mvc-3-and-the-helper-syntax-within-razor.aspx