This is a migrated thread and some comments may be shown as answers.

Set Text RadMenuItem client side

2 Answers 189 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 31 Oct 2011, 02:09 PM
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 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 31 Oct 2011, 02:34 PM
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.
0
Jhonny
Top achievements
Rank 2
answered on 31 Jan 2014, 02:48 PM
Hi Princy, Your answer is correct,Thanks, Regards.
Tags
Menu
Asked by
Chris
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jhonny
Top achievements
Rank 2
Share this question
or