RadMenu X Root Item X Child Item

2 posts, 0 answers
  1. Ernandes
    Ernandes avatar
    16 posts
    Member since:
    Jul 2008

    Posted 16 Aug 2008 Link to this post

    Hi there,

    When creating a RadMenu have root item and 2 child items, by clicking on an item child how to get the name of the root item?

    follows an example

    function onClicking(sender, eventArgs)
        {

    var menu = $find("<%= RadMenu1.ClientID %>");
    var items = menu.get_items();

    alert("item: " + items.getItem(0).get_text());
        }


    thus, if I have more than 1 root item, I can not get their name, how to get the name of the root item when you have more than 1?

    I want that when you click on an child item, I get the name of the root item that child item.


  2. Rosi
    Admin
    Rosi avatar
    2529 posts

    Posted 18 Aug 2008 Link to this post

    Hi Ernandes,

    Please, try the following code:

    function onClicking(sender, eventArgs)  
        {  
             
            var clickedItem = eventArgs.get_item();  
     
            if(clickedItem.get_level()>0)  
            {  
               var parent = clickedItem.get_parent();  
               while(parent.get_level()>0)  
               {  
                 parent=parent.get_parent();  
               }  
              alert("item: " + parent.get_text());  
            }  
     
     
     
        }  
     

    Kind regards,

    Rosi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top