Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
475
Only getting two levels deep on hierarchical UltraTree
posted

From what I understand, the UltraTree control will automatically generate all levels depending on the relations you specify between two tables.

I'm creating a proof-of-concept using folders.  One table has all the folders.  The second table has the folder parent-child relationships.  All the folders are displayed in the tree, but only two levels deep.  See the picture attached.  For example, you can see how 5 should be under 4, and 7 under 5, but 4 and 5 are showing up at the root level.

Also note that it only shows the ID instead of the Name (A, B, C). Is there a way to get it to show the Name?

Here is the code to generate data in the dataset tables.

var folders = this.dataSet1.Tables["Folders"];

folders.Rows.Add(0, "Attachments");
folders.Rows.Add(1, "A");
folders.Rows.Add(2, "B");
folders.Rows.Add(3, "C");
folders.Rows.Add(4, "D");
folders.Rows.Add(5, "E");
folders.Rows.Add(6, "F");
folders.Rows.Add(7, "G");
folders.Rows.Add(8, "H");
folders.Rows.Add(9, "I");

var folderHier = this.dataSet1.Tables["FolderHier"];

folderHier.Rows.Add(1, 0);
folderHier.Rows.Add(2, 0);
folderHier.Rows.Add(3, 0);
folderHier.Rows.Add(4, 1);
folderHier.Rows.Add(5, 4);
folderHier.Rows.Add(6, 2);
folderHier.Rows.Add(7, 5);
folderHier.Rows.Add(8, 3);
folderHier.Rows.Add(9, 3);

DataRelation dr = new DataRelation("FolderHierarchy", dataSet1.Tables["Folders"].Columns["FolderID"], dataSet1.Tables["FolderHier"].Columns["FolderID"]);
dataSet1.Relations.Add(dr);

ultraTree1.DataSource = this.dataSet1;
ultraTree1.DataMember = "Folders";