Detect RadMenu's container

2 posts, 0 answers
  1. Meaning Of Lights
    Meaning Of Lights avatar
    24 posts
    Member since:
    Dec 2007

    Posted 22 Apr 2008 Link to this post


    How do I get the container of RadMenu? eg

    The code below removes the Menu not its container as well:
    function OnClicking(sender, eventArgs)
    var proceed = confirm("Are you sure you want to delete?");
    if (!proceed)
    return false;
    var ctrl = document.getElementById(;

    I want it to be:

    More info:
    My page consists of UserControls that users can reposition in the page.

    Each UserControl has a Rad Menu. When a user swaps around 2 UserControls the radmenu.parent.parent result is incorrect because jquery modified the client-side html but the server-side isn't aware.Therefore using server-side code doesn't work,eg:

    RadMenu_ItemClick(object sender, RadMenuEventArgs e)
     RadMenu radmenu = (RadMenu)sender;

    MyUserControl myusercontrol = (MyUserControl)radmenu.Parent.Parent;

    when 2 modules swap each others place on a page the myusercontrol is the wrong control.

    Hence I'm trying to get the client side method to work, but for the life of me I cant work out how to detect the UserControl that a RadMenu's sits it.

    Any help would be much appreciated
  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 23 Apr 2008 Link to this post

    Hi Jeremy,

    In RadMenu "Classic" you can use the DomElement field which represents the root tag of RadMenu. Then using the parentNode property you can access the HTML element which contains your RadMenu. Here is some sample code:

    var menu = <%= RadMenu1.ClientID %>;
    var parent = menu.DomElement.parentNode;

    In RadMenu for ASP.NET Ajax you can use the get_element() property to access the root tag of RadMenu. Again you can use parentNode to get the HTML element which contains that menu instance.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top