Bind datatable value as parent nodes to Treeview

2 posts, 0 answers
  1. Swapnil
    Swapnil avatar
    96 posts
    Member since:
    Aug 2013

    Posted 04 Dec 2013 Link to this post

    Hi ,
    i have datatable which contain 3 company name and i want to add employees respective to that company below company name as childs(dynamically),
    My Code
    protected void Page_Load(object sender, EventArgs e)
          int UserId = Convert.ToInt32(Session["UserId"].ToString());
          int RoleId = Convert.ToInt32(Session["RoleId"].ToString());
          dtParentNode = ObjGlobas.BindTreeView_Test(UserId,RoleId);
          RadTreeView1.DataSource = dtParentNode;
          RadTreeView1.DataFieldID = "CompId";
          RadTreeView1.DataTextField = "CompName";
    <telerik:RadTreeView ID="RadTreeView1" runat="server" Font-Names="Verdana">
                   <telerik:RadTreeNodeBinding Expanded="True"></telerik:RadTreeNodeBinding>

    how can i do that
  2. Kate
    Kate avatar
    1898 posts

    Posted 09 Dec 2013 Link to this post

    Hi Swapnil,

    To be able to establish  hierarchy with the RadTreeView control you will need to use the DataFieldParentID
    property of the control. Please take a look at the following help article to get more detailed information on how this can be accomplished - Binding to Hierarchical Data.

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top