lorena Posted December 12, 2005 Posted December 12, 2005 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: 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 Quote
eramgarden Posted December 13, 2005 Posted December 13, 2005 http://www.ondotnet.com/pub/a/dotnet/2003/02/24/aspdatactl.html Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.