473,395 Members | 1,823 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,395 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 1420

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.