Sorting files from Datalist? IO.Directory ? SortedList?

  • Thread starter Thread starter jc
  • Start date Start date
J

jc

Hello, I have this code that returns all my images to a datalist..
works great , but I'd like to try soring them by filename or maybe
file date... What's the best approach?

Right now they come back in some random order.


' create a HashTable of values to bind to
Dim pictures As New SortedList
Dim file As System.IO.FileInfo
Dim files As String()
Dim filename As String = ""
Dim i As Integer

'files =
System.IO.Directory.GetFiles(Server.MapPath(Request("path")), "*.*")
files = System.IO.Directory.GetFiles("c:\ppp\")


For i = 0 To files.Length - 1

' Create a New FileInfo object for this filename
file = New System.IO.FileInfo(files(i))
filename = file.Name.ToLower()

If filename.EndsWith(".jpg") Then
pictures("pictures/" & file.Name) = "thumb.aspx?
src=pictures/" & file.Name
End If

Repeater1.DataSource = pictures

Page.DataBind()
Next


Thanks for any help or information.
 
Back
Top