TreeView - ADO.NET Service

  • Politics
  • Sports
  • Events
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

This example demonstrates how to populate RadTreeView from ADO.NET Data Service. Check the ASPX for details about the implementation.

Expand a node to populate its children from the ADO.NET Data Service
  • DefaultCS.aspx
  • scripts.js
<%@ Page Language="C#"  Inherits="Telerik.QuickStart.QsfPage" %>

<%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
     <script type="text/javascript" src="scripts.js"></script>
    <script type="text/javascript">
        //<![CDATA[
        Sys.Application.add_load(function() {
            demo.serviceURL = '<%= ResolveUrl("TreeViewAdoNetService.svc/Links?") %>';
        });
        //]]>
    </script>
    <div class="demo-container size-thin">
        <telerik:RadTreeView RenderMode="Lightweight" runat="server" ID="RadTreeView1"  DataSourceID="EntityDataSource1"
            DataTextField="Text" DataValueField="id" LoadingStatusPosition="AfterNodeText"
            OnClientNodePopulating="nodePopulating">
            <DataBindings>
                <telerik:RadTreeNodeBinding Depth="0" ExpandMode="WebService"></telerik:RadTreeNodeBinding>
            </DataBindings>
        </telerik:RadTreeView>
    </div>
    <asp:EntityDataSource runat="server" ID="EntityDataSource1" ConnectionString="name=TelerikReadWriteEntities"
        DefaultContainerName="TelerikReadWriteEntities" EntitySetName="Links" Where="it.[parentId] IS NULL">
    </asp:EntityDataSource>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?