Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
| Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 19th, 2008, 12:57 PM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 75
Thanks: 15
Thanked 0 Times in 0 Posts
Default Populate a ASP.Net Treeview control

I am having difficulty trying to populate an asp.net TreeView Control with data stored in an Access Database. Could someone please help me get started and please be very elementary.

Thanks In Advance

 
Old November 19th, 2008, 04:40 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Did you search Google? This search:

http://www.google.com/search?hl=en&q...eview&aq=f&oq=

returns useful results like:

http://aspnet.4guysfromrolla.com/articles/083006-1.aspx
http://quickstarts.asp.net/QuickStar.../treeview.aspx

In your other post you mentioned a SqlDataSource control. I don't think it's the best tool for the job as it doesn't return hierachical data. Instead, you probably want to get a DataSet (or a Typed DataSet) to populate your control.

Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old November 21st, 2008, 07:25 AM
Registered User
 
Join Date: Nov 2008
Location: delhi, delhi, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi
 i have taken a tree control and bind that with two table
u can do easily
    public void MapTree(DataTable masterTable, DataTable childT)
    {
        TreeNode mainMenu = new TreeNode();
        mainMenu.Text = "Menu";
        for (int loop = 0; loop < masterTable.Rows.Count; loop++)
        {
            TreeNode menu = new TreeNode();
            menu.Text = masterTable.Rows[loop][1].ToString();
            for (int j = 0; j < childT.Rows.Count; j++)
            {
                if (childT.Rows[j][2].ToString() == masterTable.Rows[loop][0].ToString())
                {
                    TreeNode subMenu = new TreeNode();
                    subMenu.Text = childT.Rows[j][1].ToString();

                    menu.ChildNodes.Add(subMenu);
                }
            }
            mainMenu.ChildNodes.Add(menu);
        }
        treeMenu.Nodes.Add(mainMenu);
        treeMenu.ExpandAll();
        treeMenu.Style.Value = "Font-Size:12pt;Font-Bold:true;";
    }
vip





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 2.0 Treeview Ajax Problem burak ASP.NET 2.0 Professional 1 February 15th, 2007 08:23 PM
How to Create TreeView In Asp.Net jayakumar.cj ASP.NET 1.0 and 1.1 Basics 1 July 14th, 2006 09:04 AM
treeview control with checkboxes in asp.net 1.1 sandeep_345 General .NET 0 June 9th, 2006 01:56 AM
asp.net 2.0 treeview select node does not respond vhrao ASP.NET 2.0 Basics 0 February 17th, 2006 05:03 PM
TreeView Control bmains VB.NET 2002/2003 Basics 1 July 10th, 2003 05:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.