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

[Solved] 3 Level tree, in a combo, bound data set, with a cherry on top.

1 Answer 86 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ramjet
Top achievements
Rank 1
Ramjet asked on 05 Mar 2010, 07:19 PM
Hello,


I have a combobox that has a tree view nested inside. So far so good. I have a prerender event that I was planning on using to populate the tree from a dataset.

#1. First problem...For some reason the event fires 3 times resulting in the node list being created 3 times. I thought it might have to do with having 3 levels of nodes but going back to one still presents the same problem. As I understand the ASP page cycle this shouldn't be happening?

#2. Second problem is more of a question. How do I bind the data to the nodes? I have a table with say three columns State, City, School. At the top node I want State, Below The State I want all corresponding Cities, Below the Cities schools. Now I know how to generate a SQL query to get this data so lets call that done. How then shall I bind it? To each node individually? If so do I have to "loop" through putting the row into a DataRow object and then binding to each nodes DataItem?

#3. The cherry on top. Once a school has been selected I need to display that selection in the combobox and populate the comboboxes value field with the school ID. Can this be done client side or will I have to post back to update the combobox and what about the school id? Where should I hide that data while I'm waiting for them to pick a school...in a hidden (visible=false) tree view under the school?

Thanks
JB

1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 11 Mar 2010, 12:34 PM
Hello John Bonner,

I'll try to explain you how to make your scenario working in the same order as asked:

#1 & #2 : Using RadTreeView in ComboBox is nice. However why are you trying to bind the RadTreeView in Prerender event? I suggest you to use Page_Load. To bind the TreeView Nodes in your scenario most appropriate is using Hierarchical Data. Please take a look at the demo here for Binding to Hierarchical Data.

#3: Replace the cherry with a strawberry and add some cream :)

I'm not sure if I understand you correctly. You want to show the SchoolID in the text field of the RadComboBox? You may use the Attributes special collection of the RadTreeView to keep the SchoolID.
Please take a look at this topic on using Custom Attributes.

In addition you can check our online demo.

Please let me know if this was helpful.

Best wishes,
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
TreeView
Asked by
Ramjet
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or