0

I need to display the xml data in the treelist control. I have one root node, one Child node and further four children for this child node.

I am not able to display it in the treelist. I am using the dataset.readXml method for reading the xml file and giving dataset as a datasource. Here is the code I am following:

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

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

Adam Wagner
  • 15,469
  • 7
  • 52
  • 66
Raman
  • 1
  • 1
  • 1

3 Answers3

1
DataSet dataSet = new DataSet();
dataSet.ReadXml(@"C:\foldersettings.xml");
treeList2.DataSource = dataSet.Table[0];
treeList2.PopulateColumns();
treeList2.BestFitColumns();
treeList2.ExpandAll(); 
Mark Ursino
  • 31,209
  • 11
  • 51
  • 83
Akash
  • 11
  • 1
0

You should also set the KeyFieldName and ParentFieldName properties of the TreeList. Note, these properties should be set to the corresponding field names in the CaseSensitive manner. Also, the TreeList's DataSource should be set to dataSet.Tables[0]. I hope, this will help.

DevExpress Team
  • 11,338
  • 2
  • 24
  • 23
0

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

mihai
  • 2,746
  • 3
  • 35
  • 56