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

How to add Submenu with Item Template Programmatically

3 Answers 101 Views
Menu
This is a migrated thread and some comments may be shown as answers.
PC
Top achievements
Rank 1
PC asked on 08 Dec 2008, 06:28 PM
I am evaluating the products.

I have a mainmenu, and want to add submenu with item template from a datasource. 

Thanks.
Alfred

3 Answers, 1 is accepted

Sort by
0
Baatezu
Top achievements
Rank 2
answered on 08 Dec 2008, 07:04 PM
Check out this help topic on adding templates at runtime.
http://www.telerik.com/help/aspnet-ajax/menu_menu_templates_run_time.html
You will need to do some modifying to get it to work on only the submenu item, but it's doable.
0
Shinu
Top achievements
Rank 2
answered on 09 Dec 2008, 06:58 AM
Hi PC,

Adding template controls to a menu item is really simple and easy. You no longer need to define a class that implements the ITemplate interface and the other cumbersome coding normally associated with this scenario. Simply use the Add method of the Controls collection of the menu item which will hold the control. Here is an example:

CS:
protected void Button2_Click(object sender, EventArgs e) 
    Button btnExport = new Button(); 
    btnExport.Text = "Export"
    radmenu1.Items[0].Items[0].Controls.Add(btnExport); 

Thanks,
Shinu.
0
Alfred
Top achievements
Rank 1
answered on 09 Dec 2008, 07:55 AM
Thanks all.
Tags
Menu
Asked by
PC
Top achievements
Rank 1
Answers by
Baatezu
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Alfred
Top achievements
Rank 1
Share this question
or