We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to bind data to treeviewadv ? i cant find an example on this

Thread ID:

Created:

Updated:

Platform:

Replies:

145588 Jun 29,2019 02:52 PM UTC Jul 1,2019 01:48 PM UTC WinForms 1
loading
Tags: TreeViewAdv
alex
Asked On June 29, 2019 02:52 PM UTC

Dear all

My requirement is simple, i have a list of countries, each of them has a list of city. They are stored in database. I retrieve it by using sql and made a datatable with 3 columns (id, country, city), i want to present it in a tree. Root node = world, next level is country, the city attached to the country.

Another requirement is when i change the datatable, it should reflect on the treeviewadv. 

Do i need to do all of the above manually ? i mean create node, delete node, listen to datatable changes. Or TreeViewAdv already do them 

Subburaj Pandian Veluchamy [Syncfusion]
Replied On July 1, 2019 01:48 PM UTC

Hi Alex, 
  
Thank you for contacting Syncfusion support. 
  
Query 1:  My requirement is simple, i have a list of countries, each of them has a list of city. They are stored in database. I retrieve it by using sql and made a datatable with 3 columns (id, country, city), i want to present it in a tree.  
  
We have provided the Data Binding support for TreeViewAdv in our latest Volume 2 Beta 2019 release. Currently TreeViewAdv supports binding to Self-Referencing data and Relational Binding. Based on your query we have prepared a sample with Self-Referencing Data Table. Here the Parent-Child relationship is defined by setting the ParentMember and ChildMember to the respective fields in the DataSource. The data object in the ParentMember field of the DataSource that matches with the TreeViewAdv.SelfRelationalRootValue are the root nodes. Please use the below properties to bind to Self-Referencing data in TreeViewAdv. 
  
Property 
Description 
DataSource 
Gets or sets the Data Source object in TreeViewAdv 
DisplayMember 
Gets or sets the field that populates the Text property of the TreeNodeAdv in TreeViewAdv 
ValueMember 
Gets or sets the field that populates the Value property of TreeNodeAdv in TreeViewAdv 
ParentMember 
Gets or sets a value indicating the parent data field which behaves as a Parent Node in TreeViewAdv 
ChildMember 
Gets or sets a value indicating the child data field which behaves as a Child Node in TreeViewAdv 
DataMember 
Gets or sets the table name that should be bound to the TreeViewAdv 
CheckedMember 
Gets or sets a value indicating the field to populate the state of checkbox of TreeNodeAdv in TreeViewAdv 
ValueMember 
Gets or sets the field that populates the Value property of TreeNodeAdv in TreeViewAdv 
SelfRelationalRootValue 
Gets or sets the value that defines the root object in a self-relational mode when DataSource is used to define the underlying tree data. 
  
  
Note: The above properties will work only in our latest Volume 2 Beta, 2019 release. 
  
Query 2: Another requirement is when i change the datatable, it should reflect on the treeviewadv. 
  
Currently TreeViewAdv do not support Dynamic update of the underlying changes in data source settings. This feature will be implemented in our Volume 3, 2019 which is expected to be available in the month of September 2019. We appreciate your patience until then. 
  
You can track the status of this report through the following feedback link,  
  
 
Regards,
Subburaj Pandian V  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon