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

Using a dynamically populated TreeView in a ComboBox?

2 Answers 62 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Joe Sixpack
Top achievements
Rank 1
Joe Sixpack asked on 12 Apr 2010, 01:40 PM
I want to use the TreeView control in a ComboBox but I want to dynamically populate the nodes in the tree rather than defining them statically in the web page.  Do you have an example of this?  My main problem is I don't understand how to access the tree control since it is in the itemTemplate of the ComboBox.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Apr 2010, 07:02 AM

Hello Joe,

You can try the following code snippet in order to access the treeview placed in the ItemTemplate of RadComboBox.

C#:

 
RadTreeView treeView = (RadTreeView)RadComboBox1.Items[0].FindControl("RadTreeView1"); // where RadTreeView1 is the ID of the treeview  
// Populate the treeview 

Also checkout the following documentation: Finding an item in template

-Shinu.

0
Veronica
Telerik team
answered on 14 Apr 2010, 01:31 PM
Hi Joe,

Shinu Raj is right! That's the way to get the RadTreeView from the RadCombobox when it is an ItemTemplate.

As an addition I've made a sample solution to show you how to create nodes dynamically.

Find the code in the attached .zip file.

Hope this helps.

Kind regards,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ComboBox
Asked by
Joe Sixpack
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Veronica
Telerik team
Share this question
or