How to set selected menu item css class in menu control RRS feed

  • 問題

  • I have a menu control in my master page, i have a default css class applied when you hover over top menu items. I want to apply different css when the item is selected, I applied static menu item css style but it is not working properly. sample of my menu html:

    <asp:Menu ID="NavigationMenu" runat="server" EnableViewState="false" CssClass="CLASS1"
                        IncludeStyleBlock="false" Orientation="Horizontal" SkipLinkText=""  >
                        <StaticSelectedStyle CssClass="CLASS2" />
                            <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home" Selectable="true" Selected="true"  />
                            <asp:MenuItem NavigateUrl="~/contact.aspx" Text="Contact" Value="Contact" />


    I want to apply CLASS2 when the item is selected ? how can i do that ? the above html is not working/applied.

    any help is appreciated.

    Mostafa Arafa Elzoghbi
    2011年4月13日 下午 06:35


  • Hi,

    As this is an ASP.NET question in English, it is recommended you get further support at ASP.NET forum. The engineers and community members there can help you in an efficient way.


    Thanks for understanding.



    Leo Tang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年4月18日 上午 03:54