Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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

Reply With Quote
  #2 (permalink)  
Old November 19th, 2008, 04:40 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #3 (permalink)  
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.