Thread: GetFiles() Help
View Single Post
  #9 (permalink)  
Old April 17th, 2008, 08:54 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

BTW: as an alternative, you can change the file name in one of the data events of your DataGrid, like ItemDataBound. That way, you can still bind your FileInfo list, but only change the name when it;s displayed.

Finally, you could create a little helper method that does this. Something like this in your Grid:

... <%# ConvertFileName(Eval("FullName")) %> ...

With this code in the Code Behind:

Protected Function ConvertFileName(ByVal fileName As Object) As String
  Dim localFileName As String = CType(fileName, String)
  If localFileName.EndsWith(.....)
    Return "WhatEverYouWant"
  End If
  Return localFileName
End Function

Hope this helps,

Imar Spaanjaars
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.