ViewMasterPage has a ViewContext property. ViewContext contains RouteData. RouteData should have an entry for the name of the controller and the current action, if they are not standard. You can use them in your logic on the main page to determine which navigation items stand out.
, , RouteData ViewContext ViewUserControl.
EDIT: , .
<%
var current = this.ViewContext.RouteData.Values["controller"] as string ?? "home";
%>
<ul>
<li><%= Html.ActionLink( "Home", "index", "home", null, new { @class = current == "home" ? "highlight" : "" } %></li>
...
</ul>
, HTML, . , ViewContext, . , , html- ( ) .
<ul>
<li><%= Html.NavLink( "Home", "index", "home" ) %></li>
...
</ul>
public static class HtmlHelperExtensions
{
public static string NavLink( this HtmlHelper helper,
string text,
string action,
string controller )
{
string current = helper.ViewContext.RouteData.Values["controller"] as string;
object attributes = null;
if (string.Equals( current, controller, StringComparison.OrdinalIgnoreCase ))
{
attributes = new { @class = "highlight" };
}
return this.ActionLink( text, action, controller, null, attributes );
}
}