esosteEsomb
New Member
I have been trying to solve this problem and I can't seem to figure it out. I'm not sure if it's because of my db design and LINQ, but I'm hoping for some direction here.My db table:Id Name ParentId
1 Data1 null
2 Data2 null
3 Data3 null
4 Data4 1
5 Data5 1
6 Data6 2
7 Data7 2
Basically Data1 and Data2 are the top levels that I want to use for headings and their children will be related based on their ParentID.I am trying to use a listview to present the data like the following
ata1
-----
Data4
Data5
Data2
-----
Data6
Data7
I am trying to use a combination of LINQ and listview to accomplish this.The following is the code for the linq query:\[code\]var query = from data in mydb.datatablewhere data.ParentId == nullselect data;\[/code\]But this only gives the heading level... and unfortunately listview only takes in 1 datasource.
1 Data1 null
2 Data2 null
3 Data3 null
4 Data4 1
5 Data5 1
6 Data6 2
7 Data7 2
Basically Data1 and Data2 are the top levels that I want to use for headings and their children will be related based on their ParentID.I am trying to use a listview to present the data like the following

-----
Data4
Data5
Data2
-----
Data6
Data7
I am trying to use a combination of LINQ and listview to accomplish this.The following is the code for the linq query:\[code\]var query = from data in mydb.datatablewhere data.ParentId == nullselect data;\[/code\]But this only gives the heading level... and unfortunately listview only takes in 1 datasource.