View previous topic :: View next topic |
Author |
Message |
anwarbv
Joined: 27 Nov 2006 Posts: 3
|
Posted: Wed Dec 06, 2006 6:49 am Post subject: Recursive Binding to a table |
|
|
Hello Grant,
can you tell me how i can do a recursive bind to a tbale having parent child relation within the same table.
example
id
name
parentid
id........Name..........parentid
1.........Boss...........1
2.........Jug.............1
3.........Reg.............2
so how can i create structure which displays in the virtual tree as
Boss
--------Jug
-----------Reg
In vb.net if possible please
regards
Anwar |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Dec 06, 2006 10:56 pm Post subject: |
|
|
If the table is in a DataSet then you can setup a Relation in the DataSet between the ID and Parent_ID. You can create a DataView and set the RowFilter to "Parent_ID IS NULL" and set the DataView as your DataSource. You bind to this DataView as you would a normal data table in a data set.
I suspect however from our previous correspondence that you don't have a DataSet and are dealing with isolated DataTables. In this case you will need to locate the parent DataRow (ie with Parent_ID NULL) and set this as you data source. Then you will need to handle the GetChildren event and locate the child DataRows for the given eventArgs.Row.Item (which will be a DataRow) put them into a collection (eg an ArrayList) and return them in the eventArgs.Children _________________ Infralution Support |
|
Back to top |
|
|
|