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

Declarative DataSource

SiteMapDataSource

  • All

ObjectDataSource

  • UI for ASP.NET Ajax
  • UI for Silverlight

SqlDataSource

  • Fuller
RadDropDownTree supports binding to various types of data sources, including declarative datasources.

Some of the declarative data sources like the XmlDataSource and the SiteMapDataSourceare inherently hierarchical. Therefore when data-bound to these types of data sources, RadDropDownTree automatically creates the node hierarchy. There is no need to use the DataFieldID and DataFieldParentID properties.

RadDropDownTree supports binding to an ObjectDataSource as well. In addition to the standard Entry properties (Text, Value, etc.) that can be bound to the underlying business objects, the DataFieldID and DataFieldParentID properties can be specified, too. In this way, RadDropDownTree can create a hierarchy of Entries.

Still, the business objects should provide the data needed for the RadDropDownTree to build the hierarchy. If the ParentID property of the business objects are of nullable or reference type, then null values denote root Entry. In case, the ParentID property is of value type (Integer, Guid, etc.), '0'/'Guid.Empty' values denote the root Entry.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • styles.css
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="DefaultVB.aspx.vb" Inherits="DropDownTree.Examples.PopulatingWithData.DeclarativeDataSource.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 rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-containers">
        <div class="demo-container size-thin">
            <h2>SiteMapDataSource</h2>

            <telerik:RadDropDownTree RenderMode="Lightweight" ID="RadDropDownTree1" runat="server" Width="300px" DefaultMessage="Please select"
                DataSourceID="SiteMapDataSource1" OnNodeDataBound="RadDropDownTree1_NodeDataBound">
            </telerik:RadDropDownTree>
        </div>
        <div class="demo-container size-thin">
            <h2>ObjectDataSource</h2>

            <telerik:RadDropDownTree RenderMode="Lightweight" ID="RadDropDownTree2" runat="server" Width="300px" DefaultMessage="Please select"
                DataSourceID="ObjectDataSource1" DataFieldID="ID" DataFieldParentID="ParentID"
                DataTextField="Text">
            </telerik:RadDropDownTree>
        </div>
        <div class="demo-container size-thin">
            <h2>SqlDataSource</h2>

            <telerik:RadDropDownTree RenderMode="Lightweight" ID="RadDropDownTree3" runat="server" Width="300px" DefaultMessage="Please select"
                DataFieldID="EmployeeID" DataFieldParentID="ReportsTo" DataTextField="LastName"
                DataSourceID="SqlDataSource1">
            </telerik:RadDropDownTree>
        </div>
    </div>
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"></asp:SiteMapDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetSiteData"
        TypeName="Telerik.Web.Examples.SiteDataItem"></asp:ObjectDataSource>
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="SELECT * From Employees"></asp:SqlDataSource>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance