Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > display a file list to enable downloading

Reply
Thread Tools

display a file list to enable downloading

 
 
Paul Wilson
Guest
Posts: n/a
 
      08-02-2004
How do i display the list of files in a particular directory (only the file
name), in a grid or similar control, with hyperlinks to be able to download
those files.

Regards,
Paul


 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmhhcmF0IEJpeWFuaQ==?=
Guest
Posts: n/a
 
      08-02-2004
Hi Paul,

U can use the DirectoryInfo.GetFiles() method to get the list of files in the directory and then bind the result to a datagrid. Here's some sample code:

//to be put in the codebehind file
DirectoryInfo di=new DirectoryInfo("C:\\");
FileInfo[] fi=di.GetFiles();
DataGrid1.DataSource=fi;
DataGrid1.DataBind();

//in the aspx file
<aspataGrid id="DataGrid1" runat="server" AutoGenerateColumns=false>
<Columns>
<asp:BoundColumn HeaderText="Name" DataField="Name"/>
<asp:BoundColumn HeaderText="Date Created" DataField ="CreationTime" />
</Columns>
</aspataGrid>


--
Bharat Biyani ((E-Mail Removed))
http://www.orcim.com



"Paul Wilson" wrote:

> How do i display the list of files in a particular directory (only the file
> name), in a grid or similar control, with hyperlinks to be able to download
> those files.
>
> Regards,
> Paul
>
>
>

 
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
Indeed, content is downloading, source seems OK, but NO DISPLAY IN BROWSER Fabrizio J Bonsignore C++ 5 03-02-2012 07:21 AM
enable logging ::: ip access-list any any log Vasu Cisco 2 03-03-2007 08:58 AM
How to enable people to pay me....(enable credit card payments in my web app) Patrick ASP .Net 1 11-10-2005 11:07 AM
how to enable the HScroll bar and display a tool tip Deepak ASP General 1 06-09-2004 02:29 PM
How to enable "list folder contents" permission programmatically? John Dalberg Computer Security 0 05-10-2004 04:43 AM



Advertisments