This is a migrated thread and some comments may be shown as answers.

I need to show data in a tree view

2 Answers 26 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
KinG
Top achievements
Rank 1
KinG asked on 26 Feb 2019, 07:19 AM

Hello ,

 

Can you please advise how the Tree view should be setup to give this type of functionality with database table attached ?

 

thanks


2 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 28 Feb 2019, 08:16 AM
Hi KinG,

The provided data-table does not have a ParentId column, so the TreeView can be bound only with first-level nodes in a similar way:
<telerik:RadTreeView ID="RadTreeView1" runat="server" DataFieldID="id" DataTextField="Description" DataValueField="Title"></telerik:RadTreeView>

If you want to group the data (e.g. by department code or name) you will need to aggregate your data and add an "ParentID" column that will hold the data determining the hierarchy of the nodes. You can find detailed information about the specifics on binding RadTreeView to a database here:
https://docs.telerik.com/devtools/aspnet-ajax/controls/treeview/getting-started/binding-to-a-database


The following demo also represents a very simple demo for such setup so I will advise you to review it: 
https://demos.telerik.com/aspnet-ajax/treeview/examples/programming/databinding/defaultcs.aspx

Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
KinG
Top achievements
Rank 1
answered on 04 Mar 2019, 05:48 AM
thank you for support
Tags
TreeView
Asked by
KinG
Top achievements
Rank 1
Answers by
Vessy
Telerik team
KinG
Top achievements
Rank 1
Share this question
or