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

Use SQL data to populate TreeView

1 Answer 392 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jason Bourdette
Top achievements
Rank 1
Jason Bourdette asked on 03 May 2013, 02:36 PM
I have a flat SQL table and i'm wondering if there is an easy way to use that data to populate a RadTreeView control. Currently I take the flat sql table and create a new sql table that is more tree structured, then i use the asp.net treeview with the loadondemand property. i'd like to move to using the RadTreeView control and use the flat sql table without having to create a new table.

Example data i have:
| id  |  company_name|  product |  ...
  1      company1     product1
  2      company1     product3
  3      company3     product1
  4      company2     product1
  5      company3     product2

Using a Select * FROM Tablename query can i possibly get that data into a radtreeview so it would look like below.

company1
  * product1
  * product3
company2
  * product1
company3
  * product1
  * product2


thanks
jason

1 Answer, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 06 May 2013, 01:29 PM
Hi Jason,

Please review the following help article that describes what a SQL table should look like in order to be easily bindable to RadTreeView:
http://www.telerik.com/help/aspnet-ajax/treeview-data-binding-hierarchical.html

Here are also a couple of variations on how you can bind your treeview:
http://www.telerik.com/help/aspnet-ajax/treeview-data-binding-use-databindings-tutorial.html
http://www.telerik.com/help/aspnet-ajax/treeview-data-binding-loading-related-tables.html

 

Kind regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TreeView
Asked by
Jason Bourdette
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Share this question
or