PC Review


Reply
Thread Tools Rate Thread

Display a list of files

 
 
Guest
Posts: n/a
 
      15th Oct 2007
I need to get a list of files in a directory, say c:\temp, and display it in
a drop down list. How would I do that?


 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      15th Oct 2007
Use System.IO

Here's a tutorial for you :

http://msconline.maconstate.edu/tuto...pnet12-01.aspx




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
======================================
<tester> wrote in message news:(E-Mail Removed)...
>I need to get a list of files in a directory, say c:\temp, and display it in a drop down list. How would I do that?
>



 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      15th Oct 2007
<tester> wrote in message news:(E-Mail Removed)...

>I need to get a list of files in a directory, say c:\temp, and display it
>in a drop down list. How would I do that?


http://msdn2.microsoft.com/en-us/library/system.io.directory.getfiles(vs.80).aspx

This is server-side only - for (fairly obvious) security reasons, you can't
query the file system that a browser is running on without some sort of
client-side component e.g. WSH...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Guest
Posts: n/a
 
      19th Oct 2007
Thanks, that works. Now I want to display the list sorted by date, so that
the most recent date is at the top of the list and automatically selected in
the drop down list. how would I do that?

<tester> wrote in message news:(E-Mail Removed)...
>I need to get a list of files in a directory, say c:\temp, and display it
>in a drop down list. How would I do that?
>



 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      19th Oct 2007
<tester> wrote in message news:(E-Mail Removed)...

> Thanks, that works. Now I want to display the list sorted by date, so
> that the most recent date is at the top of the list


There's no built-in way to do that just with the GetFiles method. However,
what you require is easily achieved by adding the results to a generic and
sorting that:
http://blogs.msdn.com/markda/archive...20/580075.aspx

> and automatically selected in the drop down list.


Unless you specify otherwise, the first item in your DropDownList will be
selected by default.


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you get a list of files from server folder to display on in a list control maglev_now@yahoo.com Microsoft ASP .NET 4 20th Oct 2006 01:39 PM
List box display of external text files =?Utf-8?B?cmljaGFyZGI=?= Microsoft Access External Data 12 23rd Jan 2005 08:48 PM
How do I display external files to a dropdown list? =?Utf-8?B?U2xlZXBsZXNzVGV4YXM=?= Microsoft Access VBA Modules 1 21st Dec 2004 03:26 AM
How do I display a list of files using IIS on a client PC? sean Microsoft Windows 2000 Deployment 1 8th Dec 2003 08:57 AM
How can I display a list of files using IIS 5? =?Utf-8?B?c2VhbiBjaG9v?= Microsoft Windows 2000 Deployment 3 4th Dec 2003 09:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:37 PM.