0

hi
I have to add nodes and subnodes to a tree view from sql database in asp.net(VB.Net) 2.0

How to do this
i have 3 tables
i want to add nodes from first table and respective childnodes from the 2nd table subsiquent child nodes from the 3rd table

how to do this

3
Contributors
2
Replies
4
Views
10 Years
Discussion Span
Last Post by bassam572009
0

The easiest way is to write a query to select the data from all 3 tables and put them into a dataset with relationships.
Then you just have to iterate through the first table one row at a time and create a node for it. Then run through that rows child rows one at a time and create a node for them and add them to the parent node, and run through each of the child rows of those rows and do the same.
In pseudo code (as i am more a C# than Vb person)

..Create Dataset with 3 tables and 2 relationships
Create a top node
For each table1row in table1
Create table1node
Add it to topnode's node
for each table2row in table1row.getchildrows()
Create table2node
Add it to table1node
for each table3row in table2row.getchildrows()
Create table3node
end table3row for each
end table2row foreach
end table1row foreach
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.