Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Display a list of files

Reply
Thread Tools

Display a list of files

 
 
Guest
Posts: n/a
 
      10-15-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
 
      10-15-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:...
>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
 
      10-15-2007
<tester> wrote in message news:...

>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/lib...es(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
 
      10-19-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:...
>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
 
      10-19-2007
<tester> wrote in message news:...

> 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

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
Memory issues when storing as List of Strings vs List of List OW Ghim Siong Python 2 11-30-2010 12:22 PM
Appending a list's elements to another list using a list comprehension Debajit Adhikary Python 17 10-18-2007 06:45 PM
Why does list.__getitem__ return a list instance for subclasses ofthe list type? dackz Python 0 02-06-2007 04:44 PM
How do you get a list of files from server folder to display on in a list control maglev_now@yahoo.com ASP .Net 4 10-20-2006 12:39 PM
Difference Between List x; and List x(); , if 'List' is a Class? roopa C++ 6 08-27-2004 06:18 PM



Advertisments