MetroTouch skin

TreeView - Data Bindings

  • Politics
    • CNN
    • NBC
    • ABC
  • Sports
    • US Sports
    • European Sports
  • Events
    • Oscar Awards
    • MTV Movie Awards
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

The DataBindings collection lets you provide different sets of data bindings to the nodes on different levels of the treeview. You can even bind the nodes on each level of the treeview from different tables in a DataSet.

This example demonstrates how to use databindings to apply declarative mapping of data fields to treeview node properties.
<telerik:RadTreeView runat="server" ID="RadTreeView1" DataSourceID="SqlDataSource1"
DataFieldID="id" DataFieldParentID="parentID" Skin="Vista" CheckBoxes="true">
		<telerik:RadTreeNodeBinding TextField="Text" />
  • DefaultCS.aspx
<%@ Page Language="C#" AutoEventWireup="true"  Inherits="Telerik.QuickStart.QsfPage" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <style type="text/css">
        .rootNode {
            font-size: 13px;
            font-weight: bold;
    <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="SqlDataSource1"
            DataFieldID="id" DataFieldParentID="parentID" CheckBoxes="true">
                <telerik:RadTreeNodeBinding TextField="Text"></telerik:RadTreeNodeBinding>
                <telerik:RadTreeNodeBinding Depth="0" Checkable="false" TextField="Text" Expanded="true"
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        SelectCommand="SELECT id, text, parentId from Links"></asp:SqlDataSource>

Find Assistance

Help Us Improve

Was this example helpful?