473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help - Programmatically Building a Treeview from Database



Hello.

Please bear with me if this seems like a basic question (I'm just getting started with all this ASP.NET and WebControls stuff).

Anyway, I'm trying to programmatically build a treeview based off a dataset that I've queried from our database. First, I'm manually creating and adding the "root" node to the treeview control. Then, I'm trying to iterate through my dataset and build all the folders and files under the root node.


An example of the dataset looks like:



Report | MonSite | Category

ReportName13 | Auxi A | <NULL>

ReportName27 | Auxi A | <NULL>

ReportName22 | Auxi B | <NULL>

ReportName14 | <NULL> | Calibration

ReportName25 | <NULL> | Calibration

ReportName16 | Auxi A | Calibration

ReportName17 | Auxi A | Calibration

ReportName18 | Auxi A | Calibration

ReportName1 | Unit 1 | Calibration

ReportName7 | Unit 2 | Calibration

ReportName19 | Auxi B | Downtime

ReportName20 | Auxi B | Downtime

ReportName21 | Auxi B | Downtime

ReportName2 | Unit 1 | Downtime

ReportName8 | Unit 2 | Downtime

ReportName3 | Unit 1 | EDSCMS

ReportName9 | Unit 2 | EDSCMS

ReportName23 | <NULL> | Excess Emission

ReportName26 | <NULL> | Excess Emission

ReportName4 | Unit 1 | Excess Emission

ReportName10 | Unit 2 | Excess Emission

ReportName5 | Unit 1 | Other Summary

ReportName11 | Unit 2 | Other Summary

ReportName6 | Unit 1 | RATA

ReportName12 | Unit 2 | RATA





And, the completed treeview needs to look something like:



Root

[No category] (for the <NULL> category field)

MonSite

Report

Report

MonSite

Report

Category

MonSite

Report

MonSite

Report

Report

Category

MonSite

Report

(etc.)




I'm having the most difficult time doing this. Can someone provide some advice and/or sample code to help me? Any info. would be greatly appreciated.



Thanks.



Nov 18 '05 #1
0 1419

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: serge calderara | last post by:
Dear all, I am populating a treeview control with an XML file. I need to skip duplicate node entry from XML file in treeview if exit For that I ma using the following line of code : If...
12
by: serge calderara | last post by:
Dear all, I have a function that I need to run in a thread due to the fact that it can takes long time to execute according to the amount of data to collect. This function is also populating a...
1
by: MyndPhlyp | last post by:
I am about to completely lose what is left of my poor mynd! The historical dissertation gets rather verbose, so I hope you can wade through it all. I really need some help on this one or I'm...
1
by: ADAM BETCHER | last post by:
Hi: I am using TreeView in a Microsoft Access 2000 form. I can create the tree, populate it and select items. Now I want to Programmatically select and highlight a node on the tree based...
0
by: Teemu | last post by:
Hello. Please bear with me if this seems like a basic question (I'm just getting started with all this ASP.NET and WebControls stuff). Anyway, I'm trying to programmatically build a...
2
by: Tim::.. | last post by:
Hi can someone please tell me how I dynamically create a menu like the one shown below from a database. I want to create a loop that loops through all the records in a table and builds a table...
4
by: Henry | last post by:
Does anybody have a real-world sample of buiding a treeview control using data from database tables? All the sample code I have found either builds the treeview manually or uses a file directory...
2
by: Tom | last post by:
My older system: Win2k, VS2005(Academic), .Net 2.0 SP1. Windows.Forms Application: Two splitter panels, a TreeView (named: "tree") in one panel populated with directory name nodes. Logic for...
32
by: =?Utf-8?B?U2l2?= | last post by:
I have a form that I programmatically generate some check boxes and labels on. Later on when I want to draw the form with different data I want to clear the previously created items and then put...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.