User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 374,023 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,805 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 4988 | Replies: 1
Reply
Join Date: Jan 2007
Posts: 16
Reputation: rinkuchoudhury is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rinkuchoudhury rinkuchoudhury is offline Offline
Newbie Poster

Help add nodes and subnodes to a treeview from sql database by coding in asp.net 2.0

  #1  
Mar 26th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2006
Location: Its the internet... i am everywhere lol
Posts: 274
Reputation: f1 fan is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 10
f1 fan f1 fan is offline Offline
Posting Whiz in Training

Re: add nodes and subnodes to a treeview from sql database by coding in asp.net 2.0

  #2  
Mar 26th, 2007
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 11:28 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC