RadTreeView for ASP.NET Ajax - Binding to LinqDataSource

Posted by: the telerik blogs, on 01 Oct 2008 | View original | Bookmarked: 0 time(s)

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"
    dataclasses
  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
    employees
  4. Open Default.aspx in design mode and drag a new RadTreeView instance.
  5. Open the smart tag and select "New data source":
    datasource
  6. Choose "LinqDataSource" from the "Data Source Configuration Wizard":
    linqdatasource
  7. Configure the newly created datasource to use the NorhtwindDataContext object:
    choosecontextobject
  8. Select the "EmployeeID", "LastName" and "ReportsTo" columns from the "Configure Data Source" dialog:
    configuredataselection
  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:
    image

[Download]

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: DataSet | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 3011 | Hits: 16

Similar Posts

  • Iterating on an ASP.NET MVC Model Binder more
  • A lovely couple (of architecture books) more
  • Ajax.NET Professional and ASP.NET MVC more
  • Dynamic Delegates with Expression Trees more
  • AJAX >> Using AJAX to load a usercontrol that has refers to a custom css file more
  • ASP.NET Memory Issues more
  • MSMQ, WCF and IIS: Getting them to play nice (Part 2) more
  • How to setup a new AjaxEngine web project more
  • Error: A ScriptManager is required on the page to use ASP.NET AJAX Script Components... more
  • How to... use Class Libraries with ASP.NET AJAX like AjaxPro more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD