To hide and show the menu on the client, we will take advantage of the DomElement property of the menu. Here is an example:
| |
Copy Code |
|
<!-- menu --> <rad:RadMenu ID="RadMenu1" runat="server" > . . . </rad:RadMenuItem>
<!-- show and hide buttons --> <input id="Button1" type="button" onclick="hidemenu()" value="hide menu" /> <input id="Button2" type="button" onclick="showmenu()" value="show menu" />
<!-- java script functions --> <script type="text/javascript"> var menu = <%= RadMenu1.ClientID %>
function hidemenu() { menu.DomElement.style.display = "none"; }
function showmenu() { menu.DomElement.style.display = ""; } </script> |
The above code hides the menu when the user clicks on the hide menu button and shows the menu when the user clicks on the show menu button.
If the menu is context (IsContext=true), you can use the Show and Hide methods of the menu to achieve the same functionality. Note, that these methods will work only for context menus.
For more information on DomElement property and the Show and Hide methods of the menu, please view the help topic on RadMenu Client Object.