Use ClickToOpen and OnItemClick

3 posts, 0 answers
  1. Adek
    Adek avatar
    22 posts
    Member since:
    Mar 2009

    Posted 07 Aug 2009 Link to this post

    Hi

    How use ClickToOpen and OnItemClick when clicked Level 0 I have postback how it block?

    Thanks

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Aug 2009 Link to this post

    Hi,

    Try the following approach in order to cancel the postback if user clicked root item.

    ASPX:
     
    <telerik:RadMenu ID="RadMenu1" runat="server" ClickToOpen="True" OnClientItemClicking="OnClientItemClicking" 
        OnItemClick="RadMenu1_ItemClick">  
        <Items> 
         . . .  
        </Items> 
    </telerik:RadMenu> 

    JavaScript:
     
    <script type="text/javascript">  
    function OnClientItemClicking(sender, eventArgs)  
    {  
        var item = eventArgs.get_item();  
        
        if (item.get_level() == 0)  
        {  
            item.open();  
          eventArgs.set_cancel(true);  
        }  
        else  
        {  
          eventArgs.set_cancel(false);  
        }  
    }  
    </script> 

    Thanks,
    Princy.
  3. Adek
    Adek avatar
    22 posts
    Member since:
    Mar 2009

    Posted 07 Aug 2009 Link to this post

    ok but I use you example but level 1 must click ..
Back to Top