Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1805
WebDataMenu : How to change selected items background colour
posted

I have 5 items in my webdatamenu when I hover it changes the colour to what I want. but when I click on the menu item I get my page - but menu colour defaults.

I want menu item to stay changed colour. so user can know what page / link he is on..

any ideas?

Parents
No Data
Reply
  • 49378
    Verified Answer
    posted

    Hello Jagjot,

    WebDataMenu features css classes and properties for styling the selected and active items, however the control is configured to remove the selection styling after the focus is lost. Therefore I would suggest manually handling the ItemClicked clientside event in order to apply (and remove) a selection class on the clicked item as such:

        <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" id="igClientScript">
    <!--
     
        var lastItemElement;
        function WebDataMenu1_ItemClick(sender, eventArgs) {
            if (lastItemElement != null) {
                $(lastItemElement).removeClass("selectedItem");
            }
     
            lastItemElement = eventArgs.getItem().get_element();
            $(lastItemElement).addClass("selectedItem");
            //Add code to handle your event here.
        }// -->
        </script>

    Hope this helps. Please feel free to contact me if you have any questions.

Children