ASP.NET: Highlight menu item of current page

There’s a StaticSelectedStyle property that you can use inside your menu.

<asp:menu [...]>
        <staticselectedstyle backcolor="LightBlue"


See here for more info.

Also, if there’s a class applied to the selected item (which i’m not sure if there is but it would be handy) you can simply hook into that with your CSS. This would be a much nicer way than using the StaticSelectedStyle property.


It’s worth noting also that your use of IncludeStyleBlock="false" will stop your menu from generating the CSS necessary to control the selected item.

With the style block turned off, you have to provide your own styles and the auto-generated styles of the menu will not be used.

From MSDN:

If you set this property to false, you cannot set style properties.
For example, you cannot add a DynamicHoverStyle-ForeColor attribute in
markup or set the DynamicHoverStyle.ForeColor property in code.


Leave a Comment