ASP.NET Slide Menu - Knowledge Base

« Back to Knowledge Base list

How to set different style for one or more parent than the others set by the StyleFolder?

Q:

How to set different style for one or more parent than the others set by the StyleFolder?

A:

A script block can be added after the Slide Menu declaration to set the style from client side.

        <osm:SlideMenu id = "plain"
                runat = "server"
                StyleFolder = "styles/plain">
            <menuitems>
                <osm:Parent id="a"...
                .....
            </menuitems>
        </osm:SlideMenu>
        <script type="text/javascript">

            function setParentStyle() {
                var fstparent = document.getElementById("a");
                fstparent.style.backgroundColor = "Lime";
                fstparent.style.fontWeight = "bold";
            }
            setTimeout(setParentStyle, 50);
        </script>