Use SQL data to populate TreeView

2 posts, 0 answers
  1. Jason Bourdette
    Jason Bourdette avatar
    77 posts
    Member since:
    Jan 2010

    Posted 03 May 2013 Link to this post

    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
  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 06 May 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top