Data binding treeview

2 posts, 0 answers
  1. Tina
    Tina avatar
    130 posts
    Member since:
    Jul 2011

    Posted 02 Apr 2012 Link to this post

    How can I bind treeview using sqldatasource from code behind?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 02 Apr 2012 Link to this post

    Hi Tina,

    Try the following code to bind RadTreeView to SqlDataSource.

    <telerik:RadTreeView ID="treeView" runat="server"></telerik:RadTreeView>

    protected void Page_Load(object sender, EventArgs e)
         SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Employees",ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
         DataSet links = new DataSet();
         treeView.DataTextField = "LastName";
         treeView.DataFieldID = "EmployeeID";
         treeView.DataFieldParentID = "ReportsTo";
         treeView.DataSource = links;

    For more information please take a look into documentation and Demo.

Back to Top