Remove child item through JavaScript.

4 posts, 1 answers
  1. Berkman
    Berkman avatar
    23 posts
    Member since:
    Feb 2013

    Posted 07 Mar 2013 Link to this post

    Hi,

    I want to remove a child menu item from my RadMenu using javascript but the script is not working well. Here is the code I tried.
    function RemovePremium()
    {  
        var menu1 = $find("<%= RadMenuUser.ClientID %>");  
        var menuItem1 = menu.findItemByText("Get Promo");
        if (menuItem1)  
        {             
            menu1.trackChanges();    
            menu1.remove(menuItem1);
            menu1.commitChanges();
    } }

    Please give your suggestions and help.
    Berk.

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

    Posted 08 Mar 2013 Link to this post

    Hi,

    Try modifying the code as shown below.
    JS:
    function RemovePremium() {
            var menu = $find("<%= RadMenuUser.ClientID %>");
            var menuItem = menu.findItemByText("Get Promo");
            if (menuItem) {
               var parentItem = menuItem.get_parent();
                menu.trackChanges();
                parentItem.get_items().remove(menuItem);
               menu.commitChanges();
    }
    }

    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. A. Koster
    A. Koster avatar
    8 posts
    Member since:
    Oct 2006

    Posted 25 Jul 2014 Link to this post

    Hello,
          Can anyone help me out of my issue. I'm using tab key for index change in the Radmenu for that using below javascript and its working fine but for the last Radmenuitem the child items is not getting hide. so how can i want to change this code to getting hide???

    <script language="javascript" type="text/javascript">
    function OnClientItemFocus(sender, eventArgs) 
    {
    eventArgs.get_item().open();
    }
    </script>

    Thanks in Advance
    Regards
    Reshmaa Ramamurthy.
  5. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 30 Jul 2014 Link to this post

    Hello Reshmaa,

    I noticed that you asked the same question in another forum thread. To avoid misunderstanding and duplications, let's continue our communication there:
    http://www.telerik.com/forums/how-to-get-selection-index-of-radmenu-using-javascript
    Please review our answer and let us know how it goes.

    Regards,
    Aneliya Petkova
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top