Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 June 4th, 2007, 01:50 PM
Registered User
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default IDataSource = how do you get data into it!?

<script runat="server">

    void Page_Load()
        DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/Documents"));

        Array al = di.GetFiles("*.*");


How do I get al into a IDataSource object so I can access it from <asp:treenode>??

I've tried everything, nothing works. Please help me get this array into <asp:treenode>

I'm sure its simple but C# is just different enough from PHP to thwart me- it looks similar but works completely differently...

Old June 5th, 2007, 01:38 AM
Friend of Wrox
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post

Look I can give u the idea here, but can't code it for you, there can be two simple possible ways that I know:
1. Create an XML with distinction of Folders and files like

Now bind this as datasource to the Treeview control.

2. For each directories and files, create treenodes for directories first, and the treenodes for files under it. finally add the parent directory to the main RootDirectory node.

Try any of the above, I hope you will be able to get through.


Don't expect too much, too soon.
Old June 5th, 2007, 09:44 AM
Registered User
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for your help but I need something dynamic- I've got hundreds of files and folders to display on a company intranet.

This is frusturating. Why can't ASP.net just use arrays like every other programming system in the world? Why this irritatingly different way of doing things?

I have the data in a normal array, I just can't get to it! Please help!

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in e-mail structure sending data from data tiawebchd General .NET 3 May 5th, 2008 08:07 AM
Data Binding - Editing GridView Row Data desk_star BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 7 December 30th, 2007 11:07 AM
Transfering data from csv file to data base g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 2 May 16th, 2006 11:58 PM
Binding to Filtered Data (or Data subsets) gdbjohnson C# 8 August 27th, 2004 01:59 PM

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