Since the Q2 2008 SP1 release RadTreeView, RadMenu, RadPanelBar and RadTabStrip support hierarchical databinding to the LinqDataSource control. In this blog post I will demonstrate how to do this with RadTreeView (the steps are identical for the aforementioned controls).

  1. Create a new Web Site in Visual Studio 2008 and copy the Nortwind database in your App_Data folder
  2. Add a new "Linq to SQL classes" item named "Northwind.dbml"
  3. Open "Northwind.dbml" in design mode and drag the Employees table from Server Explorer. The Employees table is self referencing and suites perfectly for this example
  4. Open Default.aspx in design mode and drag a new RadTreeView instance.
  5. Open the smart tag and select "New data source":
  6. Choose "LinqDataSource" from the "Data Source Configuration Wizard":
  7. Configure the newly created datasource to use the NorhtwindDataContext object:
  8. Select the "EmployeeID", "LastName" and "ReportsTo" columns from the "Configure Data Source" dialog:
  9. Click "Finish" and open the RadTreeView smart tag to complete the configuration
  10. Select "EmployeeID" for the DataFieldID property, "ReportsTo" for the DataFieldParentID property and "LastName" for the DataTextField property:
    image datafieldparentid datatextfield
  11. Save your page and run the web site. You should see the following page:


About the Author

Iana Tsolova

is Product Manager at Telerik’s DevTools division. She joined the company back in the beginning of 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of the ASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web development, reading articles related to geography, wild nature and latest renewable energy technologies.

Related Posts


Comments are disabled in preview mode.