Set Text RadMenuItem client side

3 posts, 0 answers
  1. Chris
    Chris avatar
    1 posts
    Member since:
    Oct 2010

    Posted 31 Oct 2011 Link to this post

    Hi team,
                   I have a RadMenu setup as a Context menu ,i want to know how to set the text property dynamically.you already discussed  this url  http://www.telerik.com/community/forums/aspnet/menu/set-text-radmenuitem-client-side.aspx .Here they are given some solution.but it is not working.

    Your code:

    var menu = <%= RadMenu1.ClientID %>;  
    var element = menu.Items[0].TextElement;  
    element.innerHTML = "new menu text";  
    menu.Show(e); 


    if i used that same  code ,i got error like "items is undefined".How to solve that issue..

    Then i need another one help from you,i want to bind the rad menu dynamically in client side jquery code.Before binding new menu item i need to clear all the old menu items.How i can do?i have tried all your samples...Please  give the correct solution for this problem.

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

    Posted 31 Oct 2011 Link to this post

    Hello Chris,

    You can try the following javascript to set text.
    JS:
    <script type="text/javascript">
    function OnClientLoad(sender, args)
    {
     sender.get_items().getItem(0).set_text("TEXT");
    }
    </script>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jhonny
    Jhonny avatar
    5 posts
    Member since:
    Nov 2013

    Posted 31 Jan 2014 in reply to Princy Link to this post

    Hi Princy, Your answer is correct,Thanks, Regards.
Back to Top