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

WebForms ODataDataSource Overview

TreeView bound to self-referencing data
TreeView bound to 2 related data tables

The demo shows two types of binding: to self-referencing data and related data contained in different objects. The first treeview is bound to a single data model which has self-reference hierarchy structure. The second treeview rely on a data from two different data models with different end points.

About RadODataDataSource for ASP.NET AJAX

RadODataDataSource is a client data source component that allows querying local and remote services that expose OData feed. It features design-time wizard for visual configuration of the data model for the data, which should be obtained from the service.

RadODataDataSource and 120+ other controls are part of UI for ASP.NET AJAX, a comprehensive toolset taking care of the common functionality of your application, while leaving you with more time to work on its business logic.

Key Features

  • Codeless binding to web services exposing OData feed.
  • Design-time Wizard for easy configuration.
  • Rich client-side Api.

More about RadODataDataSource for ASP.NET AJAX
  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • styles.css
<%@ Page Language="VB" CodeFile="DefaultVB.aspx.vb" Inherits="ODataDataSource.Examples.FirstLook.DefaultVB"   %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />

    <telerik:RadODataDataSource runat="server" ID="RadODataDataSource1">
        <Schema>
            <telerik:DataModel ModelID="Employee" Set="Employees">
                <telerik:DataModelField FieldName="EmployeeID" />
                <telerik:DataModelField FieldName="LastName" />
                <telerik:DataModelField FieldName="FirstName" />
                <telerik:DataModelField FieldName="ReportsTo" />
            </telerik:DataModel>
        </Schema>
    </telerik:RadODataDataSource>

    <telerik:RadODataDataSource runat="server" ID="RadODataDataSource2">
        <Schema>
            <telerik:DataModel ModelID="Category" Set="Categories">
                <telerik:DataModelField FieldName="CategoryID" />
                <telerik:DataModelField FieldName="CategoryName" />
            </telerik:DataModel>
            <telerik:DataModel ModelID="Product" Set="Products">
                <telerik:DataModelField FieldName="ProductName" />
                <telerik:DataModelField FieldName="ProductID" />
                <telerik:DataModelField FieldName="CategoryID" />
            </telerik:DataModel>
        </Schema>
    </telerik:RadODataDataSource>

    <div class="demo-container size-thin">
        <div class="qsf-ex-one">
            <h6 class="kd-title">TreeView bound to self-referencing data</h6>
            <telerik:RadTreeView RenderMode="Lightweight" runat="server" ID="RadTreeView1" ODataDataSourceID="RadODataDataSource1"
                DataModelID="Employee" DataFieldID="EmployeeID" DataFieldParentID="ReportsTo"
                DataTextField="FirstName" DataValueField="LastName" PersistLoadOnDemandNodes="false">
                <ClientNodeTemplate>#= Text # #= Value #</ClientNodeTemplate>
            </telerik:RadTreeView>
        </div>
    </div>
    <div class="demo-container size-thin">
        <div class="qsf-ex-two">
            <h6 class="kd-title">TreeView bound to 2 related data tables</h6>
            <telerik:RadTreeView RenderMode="Lightweight" runat="server" ID="RadTreeView2" ODataDataSourceID="RadODataDataSource2" PersistLoadOnDemandNodes="false">
                <DataBindings>
                    <telerik:RadTreeNodeBinding ModelID="Category" TextField="CategoryName" ValueField="CategoryID"
                        Depth="0" FieldID="CategoryID" />
                    <telerik:RadTreeNodeBinding ModelID="Product" TextField="ProductName" ValueField="ProductID"
                        Depth="1" FieldParentID="CategoryID" />
                </DataBindings>
            </telerik:RadTreeView>
        </div>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance