I am using TreeList
of DevExpress with C#. I have some scenario like this, I have 2 tables. Table # 1
contains directory info and Table # 2
contains files info. Column named Parent
is directory in which the directory/file is placed.
Folder Table
ID Parent Name
1 1 Folder1
2 1 Folder2
3 2 Folder3
File Table
ID Parent Name
1 1 file1.txt
2 2 file2.txt
3 2 file3.txt
I am storing both tables in dt
DataTable dt
ID Parent Name
1 1 Folder1
2 1 Folder2
3 2 Folder3
1 1 file1.txt
2 2 file2.txt
3 2 file3.txt
and doing something like this
treelist.datasource = dt;
treelist.parentfieldname = "Parent";
I want to show both files and folder in treelist
. This is not working as I have same ID of file and folder. Can anyone suggest any simple solution?
I found a quick and easy solution, i added column in dt
Folder Table
ID Parent Name
1 1 Folder1
2 1 Folder2
3 2 Folder3
File Table
ID Parent Name
4 1 file1.txt
5 2 file2.txt
6 2 file3.txt
merged both tables in dt
DataTable
ID OrigID Parent Name
1 1 1 Folder1
2 2 1 Folder2
3 3 2 Folder3
4 1 1 file1.txt
5 2 2 file2.txt
6 3 2 file3.txt
wrote same following lines
treelist.datasource = dt;
treelist.parentfieldname = "Parent";
Problem Solved!