OnClientItemClicking not working

3 posts, 1 answers
  1. Jason
    Jason avatar
    4 posts
    Member since:
    Jun 2008

    Posted 11 Jun 2008 Link to this post

    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. Answer
    Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 12 Jun 2008 Link to this post

    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
  3. Jason
    Jason avatar
    4 posts
    Member since:
    Jun 2008

    Posted 12 Jun 2008 Link to this post

    That did it. Appreciate the quick reply!
Back to Top