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

OnClientItemClicking not working

2 Answers 159 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 2
Jason asked on 12 Jun 2008, 03:55 AM
I'm evaluating the rad controls and things seem to be going well. But, I am banging my head against the wall on this one issue.

I have a radmenu with a an OnItemClick handler that is in my code behind. This works fine. I also am trying to add an OnClientItemClicking javascript handler to open a RadWindow, but when I click the menu item, I get an error "Microsoft JScript runtime error: 'Item.Text' is null or not an object".

My javascript function looks like this:

function OnClientItemClickingHandler(sender, eventArgs)  
{  
    if (eventArgs.Item.Text == "Application Configuration")  
    {  
        radopen(null,"AppSettingsWindow");  
        return false;  
    }  
}   

My menu looks like:
<telerik:RadMenu ID="RadMenu1" Runat="server" OnClientItemClicking="OnClientItemClickingHandler" OnItemClick="RadMenu1_ItemClick" ExpandDelay="50" style="z-index:3000">  
    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
    <Items> 
        <telerik:RadMenuItem runat="server" NavigateUrl="/Default.aspx" Text="Home">  
        </telerik:RadMenuItem> 
        <telerik:RadMenuItem runat="server" Text="Administration">  
            <Items> 
                <telerik:RadMenuItem runat="server" Text="Application Configuration">  
                </telerik:RadMenuItem> 
                <telerik:RadMenuItem runat="server" Text="Create master network">  
                </telerik:RadMenuItem> 
                <telerik:RadMenuItem runat="server" Text="Create new VPN">  
                </telerik:RadMenuItem> 
                <telerik:RadMenuItem runat="server" Text="Create lotsa money">  
                </telerik:RadMenuItem> 
            </Items> 
       </telerik:RadMenuItem> 
    </Items> 
    <ExpandAnimation Duration="100" Type="InOutSine" /> 
</telerik:RadMenu> 

I've searched the message board, and followed the example, but can't get this one thing working. Any ideas?

Thanks,
Jason

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 12 Jun 2008, 09:16 AM
Hello Jason,

Welcome to Telerik Community!

It seems that you are using the RadMenu for ASP.NET AJAX, but you are trying to work with the client-side API for the "classic" RadMenu.

Basically you need to replace

eventArgs.Item.Text with eventArgs.get_item().get_text();

and

return false with eventArgs.set_cancel(true);

You can have a look at the Client-side programming part of the help for RadMenu for ASP.NET AJAX

I hope this helps.

Regards,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jason
Top achievements
Rank 2
answered on 12 Jun 2008, 02:49 PM
That did it. Appreciate the quick reply!
Tags
Menu
Asked by
Jason
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Jason
Top achievements
Rank 2
Share this question
or