Database
  Home arrow Database arrow TreeView Part 1 - Populating the New TreeV...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DATABASE

TreeView Part 1 - Populating the New TreeView Control from a Hierarchical Database Table
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 28
    2005-06-08

    Table of Contents:
  • TreeView Part 1 - Populating the New TreeView Control from a Hierarchical Database Table
  • Step 1 – Drag ‘n Drop
  • Step 2 - Populating the Data
  • Step 3 - Building the Tree

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    TreeView Part 1 - Populating the New TreeView Control from a Hierarchical Database Table


    (Page 1 of 4 )

    Though the title is a mouthful it succinctly describes what will prove to be the most common use of the new TreeView control shipping with ASP.Net 2.0. The control will be perfect for implementing hierarchical structures in a User Interface, and this tutorial will show you how to actually get the data into the control from a ‘parent-child’ database table.

    Meet the TreeView – A Brief Introduction

    Asp.Net is all about speed and ease-of-use. Microsoft has taken a look at the most common problems that face Web Programmers, and has given us pre-packaged classes to meet those problems with a quick, drag-and-drop solution. The TreeView control is a perfect example of this.

    For many years Web Programmers have had to come up with complex programmatic solutions to create a simple hierarchical interface. This involved retrieving data from a database or XML file, and then wrapping our brains around complicated recursive functions that determine the structure, UI design, and event handling for what looks like a simple ‘tree’ structure. Needless to say, it’s a pain, and this led to many 3rd party components being created that you can ‘painlessly’ integrate into your application for a fee.

    Thankfully, Microsoft has decided that this is a common enough requirement, that it should in fact be part of the .Net framework. At first, a similar object was available in the unsupported ‘Advanced IE Controls’ package. Of course, it was still flaky, and only worked with Internet Explorer. Now however, it has received a full induction into the .Net class library.

    I have found this control to be quite powerful and sufficiently flexible to meet most web programming needs. I say "most" because there are a few limitations, which I’ll address the in Properties configuration section.

    This article will explain how to get parent/child styled data into the TreeView Control from a database. Some common examples of this would be in a Content Management System or site map, to display the site structure. Another common use is creating an Organizational Chart, or employee list, which is the approach I’ll take. Alright, let’s do it!

    More Database Articles
    More By Justin Cook


       · It says in the article "you will have no trouble converting it into VB".Wrong. ...
       · A waste of time??The aritcle describes the process and principles behind the...
       · very good article, thanks very much :)
       · It is a good article but very high level cause was hoping to see more complex...
       · what does the mgr_id mean? please help
       · Was a wonderful article and it really helped me.Thank you. Was wondering if we...
       · 1: I never knew C-sharp had a project much more complex than this and converted it...
       · I get an error that specifies that it can't find EmployeeListin the Page_Load...
       · Best tut on the TreeView control to "n" I have seen so far. After hours of hopeless...
     

    DATABASE ARTICLES

    - Converting Your Excel Worksheet into a Worki...
    - Excel Reference
    - Database Programming in C# with MySQL : Usin...
    - Formatting Techniques for Data Access from E...
    - Data Access from Excel VBA
    - Generating a Multiple Table Crystal Report u...
    - ADO and the Command Object
    - On Wiring Up an ADO Data Control
    - Reading and Writing to Files on the Intranet
    - Using ADO Record to Create and Navigate Intr...
    - Using Data Access Pages to Access Data on a ...
    - Using ADO with the SQL Native Client
    - ADO`s Stream Object
    - Opening a Record Object Referencing an Open ...
    - Introducing Jasper (SQL Anywhere 10 Beta)





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT