How to programmatically add an menu item?

2 posts, 0 answers
  1. Jon
    Jon avatar
    539 posts
    Member since:
    Apr 2004

    Posted 04 Nov 2008 Link to this post

    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>

     

     

  2. Jon
    Jon avatar
    539 posts
    Member since:
    Apr 2004

    Posted 04 Nov 2008 Link to this post

    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);

Back to Top