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

Declarative Datasources

Using ObjectDataSource (Animal Ancestors)

Using SqlDataSource (Delivery company organization)

RadOrgChart supports binding to various types of data sources, including declarative data sources.

The declarative data sources are hierarchical. Setting DataFieldID and DataFieldParentID properties creates parent-child relationship. Setting DataTextField property is optional.

RadOrgChart supports binding to an ObjectDataSource as well. The DataFieldID and DataFieldParentID, DataTextField properties can be bound to the underlying business object's properties.

  • DefaultCS.aspx
  • OrgChartDataItem.cs
<%@ Page Language="c#"  %>

<%@ 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 no-bg size-wide">
        <h3>Using ObjectDataSource (Animal Ancestors)</h3>
        <telerik:RadOrgChart RenderMode="Lightweight" ID="RadOrgChart2" runat="server" DataSourceID="ObjectDataSource1"
            DataFieldID="ID" DataFieldParentID="ParentID" DataTextField="Text" />
    </div>
    <div class="demo-container no-bg size-wide">
        <h2>Using SqlDataSource (Delivery company organization)</h2>
        <telerik:RadOrgChart RenderMode="Lightweight" ID="RadOrgChart3" runat="server" DataFieldID="EmployeeID" DataFieldParentID="ReportsTo"
            DataTextField="FullName" DataSourceID="SqlDataSource1" />
    </div>

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetSiteData"
        TypeName="Telerik.Web.Examples.OrgChartDataItem" />

    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="SELECT EmployeeID,ReportsTo, FirstName + ' ' + LastName As FullName From Employees Where EmployeeID < '5'" />

    </form>
</body>
</html>

Support & Learning Resources

Find Assistance