?
Solved

DevExpress XtraTreeList - tree structure

Posted on 2008-11-13
2
Medium Priority
?
3,417 Views
Last Modified: 2012-06-27
I am able to populate an XtraTreeList control from a DataTable, but no tree nodes are created. Why do the records appear beneath each other, not in a tree structure?

I'm using the following code:

DataTable dtAssignedCodes = getDatatable();
 
tvwInvcodes.ParentFieldName = "TreeID";
tvwInvcodes.KeyFieldName = "RowNumber";
tvwInvcodes.DataSource = dtAssignedCodes;
tvwInvcodes.OptionsBehavior.PopulateServiceColumns = true;
tvwInvcodes.PopulateColumns();
tvwInvcodes.BestFitColumns();
tvwInvcodes.ExpandAll();

Open in new window

0
Comment
Question by:GO-87
2 Comments
 
LVL 14

Accepted Solution

by:
Binuth earned 1000 total points
ID: 22948165
make sure that all data has proper parent key...  
like...


			DataTable dt = new DataTable();
			dt.Columns.Add("TreeID",typeof(Int32));
			dt.Columns.Add("RowNumber" , typeof(Int32));
			dt.Columns.Add("nam" , typeof(string));
 
			dt.Rows.Add(new object[] {0,1,"Aaaa"});
			dt.Rows.Add(new object[] {1,2,"Bbbb"});
			dt.Rows.Add(new object[] { 1 , 3 , "Cccc" });
 
			tvwInvcodes.ParentFieldName = "TreeID";
			tvwInvcodes.KeyFieldName = "RowNumber";
			tvwInvcodes.DataSource = dt;
			tvwInvcodes.OptionsBehavior.PopulateServiceColumns = true;
			tvwInvcodes.PopulateColumns();
			tvwInvcodes.BestFitColumns();
			tvwInvcodes.ExpandAll();

Open in new window

0
 
LVL 4

Author Comment

by:GO-87
ID: 22949131
Thanks Binuth,
You were correct - we have blanks in our TableID column.
Cheers
G
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question