Thread: GetFiles() Help
View Single Post
  #10 (permalink)  
Old April 17th, 2008, 01:07 PM
adamcherochak adamcherochak is offline
Authorized User
 
Join Date: Sep 2007
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

Just as I was about to give up and beg you for more help, I re-read your instructions and got it to work successfully!!

Problem solved.

Again, I am grateful and inspired by your expert code examples, and clear advice.

I am curious about your suggestion to create a custom class, do you have an example I could follow?

Here is the final code, I was using the HyperLinkColumn unsuccessfully at first. Then, I tried a TemplateColumn with your helper method and code-behind:
Code:
ASPX PAGE
<Columns>
     <asp:TemplateColumn HeaderText="File Name">
          <ItemTemplate>
               <asp:HyperLink ID="hyprLnk1" runat="server" Target="_self" 
               Text='<%# ConvertFileName(Eval("Name")) %>'
               NavigateUrl="javascript:LoadIFrame('../../UploadFolder/{0}');">
               </asp:HyperLink>
          </ItemTemplate>
     </asp:TemplateColumn>
</Columns>

VB CODE-BEHIND
 Protected Function ConvertFileName(ByVal fileName As Object) As String
     Dim localFileName As String = CType(fileName, String)
          If localFileName.StartsWith("1") Then
               Return "CSTLRK"
          End If
     Return localFileName
End Function