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

How to programmatically add an menu item?

1 Answer 168 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 04 Nov 2008, 11:21 PM
Hi how do I programmatically (C#) add the following menu item?
thanks

 

 

<telerik:RadMenuItem runat="server" ImageUrl="img\admin.png" Text="Admin" ToolTip= "Administration"

 

 

Value="Admin">

 

 

<Items>

 

 

 

<telerik:RadMenuItem runat="server" Text="Change Password"

 

 

ImageUrl="img\lock_preferences.png"

 

 

Value="Password">

 

 

</telerik:RadMenuItem>

 

 

<telerik:RadMenuItem runat="server" Text="Add User"

ImageUrl="img\user_new.png"

Value="AddUser">

</telerik:RadMenuItem>

 

 

 

 

</Items>

 

 

 

 

 

</telerik:RadMenuItem>

 

 

1 Answer, 1 is accepted

Sort by
0
Jon
Top achievements
Rank 1
answered on 04 Nov 2008, 11:40 PM
Got it.. thanks anyway

 

 

 

RadMenuItem NewUser= new RadMenuItem();

 

NewUser.Text =

"Add User";

 

NewUser.ImageUrl =

"img\\user_new.png";

 

NewUser.Value =

"AddUser";

 

 

RadMenuItem admin = this.RadMenu.FindItemByText("Admin");

 

admin.Items.Add(NewUser);

Tags
Menu
Asked by
Jon
Top achievements
Rank 1
Answers by
Jon
Top achievements
Rank 1
Share this question
or