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

EntityDataSource

  • cat-1
    • cat-2
    • dfg
    • Group 1

This example shows how to codelessly bind RadTreeView to EntityDataSource. Since the EntityDataSource is not hierarchical by nature you need to set the DataFieldID and DataFieldParentID properties:

<telerik:RadTreeView runat="server" ID="RadTreeView1" 
    DataSourceID="EntityDataSource1" DataTextField="Text" 
    DataFieldID="id" DataFieldParentID="parentId" >
</telerik:RadTreeView>
<asp:EntityDataSource runat="server" ID="EntityDataSource1" 
	ConnectionString="name=TelerikReadWriteEntities"
	DefaultContainerName="TelerikReadWriteEntities" EntitySetName="Links">
</asp:EntityDataSource>

You may also see how to utilize Telerik OpenAccess ORM as a data access layer for our AJAX controls by visiting the OpenAccess ORM live demos here.

  • DefaultCS.aspx
<%@ 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>
<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" />
    <div class="demo-container size-thin">
        <telerik:RadTreeView RenderMode="Lightweight" runat="server" ID="RadTreeView1" DataSourceID="EntityDataSource1" 
            DataTextField="Text" DataFieldID="id" DataFieldParentID="parentId">
            <DataBindings>
                <telerik:RadTreeNodeBinding Depth="0" Expanded="true"></telerik:RadTreeNodeBinding>
            </DataBindings>
        </telerik:RadTreeView>
    </div>
    <asp:EntityDataSource runat="server" ID="EntityDataSource1" ConnectionString="name=TelerikReadWriteEntities"
        DefaultContainerName="TelerikReadWriteEntities" EntitySetName="Links">
    </asp:EntityDataSource>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance