DevExpress TreeList Control

I need to display xml data in a twist control. I have one root node, one child node and four more children for this child node.

I can not display it in the treelist. I am using the dataset.readXml method to read an XML file and provide a dataset as a data source. Here is the code that I follow:

 DataSet dataSet = new DataSet(); dataSet.ReadXml(@"C:\foldersettings.xml"); treeList2.DataSource = dataSet; treeList2.PopulateColumns(); treeList2.BestFitColumns(); treeList2.ExpandAll(); 

Can someone tell me why I am not getting data in treelist. I am using DevExpress 9.1 version control.

0
source share
3 answers
 DataSet dataSet = new DataSet(); dataSet.ReadXml(@"C:\foldersettings.xml"); treeList2.DataSource = dataSet.Table[0]; treeList2.PopulateColumns(); treeList2.BestFitColumns(); treeList2.ExpandAll(); 
+1
source

You must also set the KeyFieldName and ParentFieldName properties in the TreeList. Note that these properties must be set to the appropriate field names in the CaseSensitive method. In addition, the DataSource TreeList must be set to dataSet.Tables [0]. Hope this helps.

0
source

This treeList from DevExpress will work fine if it finds in your DataSet a dataSet in the first column of Unique ID, because it accepts as Primary Keys, it should also find the second column, which will be considered as ParentId's.

0
source

All Articles