New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Binding to LinqDataSource

Since the Q2 2008 SP1 release RadPanelBar supports hierarchical data binding to the LinqDataSource control. This article shows how to do this in Design Time:

  1. Create a new Web Site in Visual Studio 2008 and copy the Northwind.mdf database in your App_Data folder.

  2. Add a new "Linq to SQL Classes" item named "Northwind.dbml":Linq Add New Item

  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: Employee Table

  4. Open Default.aspx in design mode and drag a new RadPanelBar instance.

  5. Open the smart tag and select "New data source": Choose Data Source

  6. Choose "LinqDataSource" from the "Data Source Configuration Wizard":Choose A Data Source Type

  7. Configure the newly created data source to use the NorhtwindDataContext object:Choose Cintext Object

  8. Select the "EmployeeID", "LastName" and "ReportsTo" columns from the "Configure Data Source" dialog:Configure Data Selection

  9. Click "Finish" and open the RadPanelBar smart tag to complete the configuration.

  10. Select "EmployeeID" for the DataFieldID property, "ReportsTo" for the DataFieldParentID property and "LastName" for the DataTextField property: Smart Tag Data Field IDSmart Tag Data Filed Parent IDSmart Tag Text Field

  11. Save your page and run the web site. You should see a page with the following RadPanelBar: Bound Linq

See Also

In this article