944,081 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 13706
  • ASP.NET RSS
Mar 26th, 2007
0

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

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rinkuchoudhury is offline Offline
16 posts
since Jan 2007
Mar 26th, 2007
0

Re: add nodes and subnodes to a treeview from sql database by coding in asp.net 2.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)
ASP.NET Syntax (Toggle Plain Text)
  1. ..Create Dataset with 3 tables and 2 relationships
  2. Create a top node
  3. For each table1row in table1
  4. Create table1node
  5. Add it to topnode's node
  6. for each table2row in table1row.getchildrows()
  7. Create table2node
  8. Add it to table1node
  9. for each table3row in table2row.getchildrows()
  10. Create table3node
  11. end table3row for each
  12. end table2row foreach
  13. end table1row foreach
  14.  
Reputation Points: 26
Solved Threads: 11
Posting Whiz in Training
f1 fan is offline Offline
275 posts
since Jan 2006
Jul 20th, 2009
0

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

if you have sample in asp.net and use vb lang
pls
send me by e-mail
<EMAIL SNIPPED>
Last edited by peter_budo; Jul 20th, 2009 at 12:09 pm. Reason: Keep It On The Site - Do not post asking for an answer to be sent to you via email or PM.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bassam572009 is offline Offline
1 posts
since Jun 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Online card payment: ASP.Net
Next Thread in ASP.NET Forum Timeline: Populating a datagrid with dynamic SQL





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC