DataGrid Hyperlink Column Question

lorena

Centurion
Joined
Oct 23, 2003
Messages
134
Location
Phoenix, Arizona
I have a datagrid that lists files in a directory with hyperlinks to each file. I would like each hyperlink to be the filename without the extension but then I need the filename with the extension for the hyperlink.
Here is the relevant part of my code:
Visual Basic:
Sub BindData()	
   'variables defined in this part - not shown
   filesTable.Columns.Add("Name", Type.GetType("System.String"))

   ' Get File Info
    arrFileInfo = dirInfo.GetFiles("*.aspx")

    For Each filesInfo In arrFileInfo
      If filesInfo.Name <> "dr.aspx" and filesInfo.Name <> "Search.aspx" then
	drFiles = filesTable.NewRow()
	ofn = filesInfo.Name
	charCt = Instr(ofn, ".aspx") -1
	ofn = Mid(ofn, 1, charCt)
	drFiles("Name") = ofn
	filesTable.Rows.Add(drFiles)
      End If
   Next filesInfo

   'code for the hyperlink column in the datagrid
  <asp:HyperLinkColumn Target="_blank" 
    DataNavigateUrlField="Name" 
    DataNavigateUrlFormatString="{0}"       
    DataTextField="Name"/>

Thanks for any help
 
Back
Top