Jeepers321
Technical User
I am currently using this code here;
ON MY CODE PAGE
ON MY ASPX PAGE
My problem is here; DataNavigateUrlField="Name"
The hyperlink is incorrect because of the location of the aspx file.
Is there a way for me to fix this without having to store my page in the images folder.
Any help would be greatly appreciated.
Thanks
ON MY CODE PAGE
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dirInfo As new DirectoryInfo(Server.MapPath(""))
DataGrid1.DataSource = dirInfo.GetFiles("images/*.jpg")
DataGrid1.DataBind()
End Sub
ON MY ASPX PAGE
Code:
<%@ Page Language="vb" AutoEventWireup="False" Codebehind="WebForm2.aspx.vb" Inherits="WebForm2"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm2</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5">[/URL]
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid Runat="server" ID="DataGrid1" AutoGenerateColumns="False">
<Columns>
[COLOR=red] <asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name" HeaderText="File Name"></asp:HyperLinkColumn>[/color]
<asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write Time" DataFormatString="{0:d}"></asp:BoundColumn>
<asp:BoundColumn DataField="Length" HeaderText="File Size" DataFormatString="{0:#,### bytes}"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
</form>
</body>
</HTML>
My problem is here; DataNavigateUrlField="Name"
The hyperlink is incorrect because of the location of the aspx file.
Is there a way for me to fix this without having to store my page in the images folder.
Any help would be greatly appreciated.
Thanks