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.
DataSet dataSet = new DataSet();
dataSet.ReadXml(@"C:\foldersettings.xml");
treeList2.DataSource = dataSet.Table[0];
treeList2.PopulateColumns();
treeList2.BestFitColumns();
treeList2.ExpandAll();
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.
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.