none
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" />
                        
                        <Items>
                            <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home" Selectable="true" Selected="true"  />
                            <asp:MenuItem NavigateUrl="~/contact.aspx" Text="Contact" Value="Contact" />
                        </Items>
                    </asp:Menu>

     

    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日 18: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.

    Http://forums.asp.net

    Thanks for understanding.

    你好,由于这里是中文论坛,你的问题更适合到发到ASP.NET论坛,谢谢。

     


    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日 3:54
    版主