Displaying List of files on the server in asp.net

Results 1 to 2 of 2

Thread: Displaying List of files on the server in asp.net

  1. #1
    Join Date
    Dec 1969

    Default Displaying List of files on the server in asp.net

    Can anyone tell me how i can do this in a particular order i.e. alphabetically or by filesize instead of the default which lists them in order they were added?<BR><BR>Here is an extract of the code I&#039;m using:<BR><BR>
    <BR>Dim sb As New Stringbuilder(4096)<BR>.<BR>.<BR>Dim dirInfo As New DirectoryInfo(currentDir)<BR>		Dim files() As FileInfo<BR>		files = dirInfo.GetFiles()<BR>		<BR>		Dim f As FileInfo<BR>		For Each f in files<BR>			Dim filename As String = f.Name<BR>                           sb.Append(Server.UrlEncode(filename))<BR>.<BR>.<BR>dirContent.Text = sb.ToString()<BR><BR><BR>
    <BR><BR>&#060;asp:label id="dirContent" runat="server" /&#062;

  2. #2
    Join Date
    Dec 1969

    Default you looking to allow dynamic selection

    of what gets sorted?<BR><BR>if no:<BR>- then for sorting by filename, i&#039;d use a "SortedList" object to insert the "f.name" insto as you whip through the files<BR>- not really sure what to do about sorting by file size since there could be duplicates<BR><BR>if yes you want to give the end use ability to choose sort item:<BR>- Put the fileinformation in a datagrid and use the grid&#039;s sort functionality

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts