ASP.NET Slide Menu - Knowledge Base

« Back to Knowledge Base list

How to set property MinimumChildrenHeight for slide menu from client-side?

Q:

How to set property MinimumChildrenHeight for slide menu from client-side?

A:

To set the height dynamically from client-side, the height need to be assigned through the slide menu client side object, which can be accessed by oboutSM{id} object where {id} indicates the ID of the slide menu. A JavaScript function will be invoked to set the height using OnClientClick handle for the each parent. O1 object within the slide menu object holds the visible menu. The operation can be done as follows:

        <script type="text/javascript">
            function setMenuHeight()
            {
                if(oboutSMslideMenu.O1)
                {
                    setTimeout(function(){
                    document.getElementById(oboutSMslideMenu.O1.id).style.height = '300px';}
                    , 200);
                }
            }
        </script>
        <osm:SlideMenu ID = "slideMenu" runat = "server" ...>
            <menuitems>
            <osm:Parent ID="a" OnClientClick="setMenuHeight()">Company Home</osm:Parent>
                <osm:Child>
                    ...
               
            <osm:Parent ID="b" OnClientClick="setMenuHeight()">System Tasks</osm:Parent>
                <osm:Child>
                    ....