This is a migrated thread and some comments may be shown as answers.

open menu item on page load

3 Answers 90 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 2
Matthias asked on 10 Nov 2008, 11:29 PM
Can I use a javascript to open a menu item on page load? <body onload="OpenItem()">?

Thanks,

Matt

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Nov 2008, 05:03 AM
Hi Matthias,

You can add "OnClientLoad" to RadMenu in order to call the JavaScript function for opening the RadMenu items.

JavaScript

function OpenItem() 
 var menu = $find("<%= RadMenu1.ClientID %>"); 
 var item = menu.findItemByText("File"); 
 item.open(); 


Regards,
Shinu.
0
Matthias
Top achievements
Rank 2
answered on 11 Nov 2008, 09:27 AM
Hi Shinu,

Thanks for your quick reply. I have tried your script, but I'm getting a javascript error: "null is null or no object"

<script type="text/javascript">  
//<!--  
 
function OpenItem() {  
 var menu = $find("<%= RadMenu1.ClientID %>");  
 var item = menu.findItemByText("Nachrichten");  
}  
 
//--> 
</script> 
 
<telerik:RadMenu ID="RadMenu1" runat="server" Style="top: 0px; left: 0px" Width="820px" 
     OnClientLoad="OpenItem()"

Regards,

Matthias
0
Princy
Top achievements
Rank 2
answered on 11 Nov 2008, 10:23 AM
Hi Matthias,

Try modifying the OnClientLoad method as OnClientLoad="OpenItem" (without brackets) in RadMenu declaration.

ASPX:
<telerik:RadMenu ID="RadMenu1" runat="server" Style="top: 0px; left: 0px" Width="820px" OnClientLoad="OpenItem">  
 
function OpenItem()   
{   
 var menu = $find("<%= RadMenu1.ClientID %>");   
 var item = menu.findItemByText("Nachrichten");   
 item.open();   
}


Thanks,
Princy.
Tags
Menu
Asked by
Matthias
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Matthias
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or