RadMenu for ASP.NET

Find RadMenu client object if it is nested as a template in another control Send comments on this topic.
Telerik RadMenu client-side > Find RadMenu client object if it is nested as a template in another control

Glossary Item Box

This is a universal method to find the RadMenu client object regardless where it is nested on the page. This method comes in handy if RadMenu is nested in another control:

RadMenu must be rendered only once. For example, you can use this approach if RadMenu is nested in a toolbar template button. However, if RadMenu is nested in a grid with more than one row, the method fails since there will be multiple instances the rendered menu for each grid row.
  Copy Code
<script type="text/javascript">

   
var menu1;

   function StoreMenuClientObject(sender)
   {
      menu1 = sender;
   }

   function UtilizeMenuClientObject()
   {
      alert(menu1.ID);
   }
</script>

<
AnyControl>
 
<Template>
    
<rad:RadMenu ID="RadMenu1" OnClientLoad="StoreMenuClientObject" runat="server">
    
</rad:RadMenu>
 
</Template>
</
AnyControl>

<
input id="Button1" type="button" onclick="UtilizeMenuClientObject()" value="button" />

The above approach is possible due to the OnClientLoad event of RadMenu.

The StoreMenuClientObject function must be declared before the RadMenu definition.