Changing base URL for ASP HyperLinkColumn

bob1979

New Member
I have a simple code to list files with \[code\]DataGrid\[/code\]. It's the server side code:\[code\]Dim dirInfo As New DirectoryInfo(Server.MapPath("~\images\"))articleList.DataSource = dirInfo.GetFiles("*.*")articleList.DataBind()\[/code\].ASPX page tag:\[code\] <asp:DataGrid runat="server" id="articleList" Font-Name="Verdana" AutoGenerateColumns="False" AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White" HeaderStyle-Font-Size="15pt" HeaderStyle-Font-Bold="True"> <Columns> <asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name" HeaderText="File Name" Target="_blank"/> <asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write Time" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" /> <asp:BoundColumn DataField="Length" HeaderText="File Size" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,### bytes}" /> </Columns> </asp:DataGrid> \[/code\]It lists files in \[code\]http://localhost/images\[/code\] but .aspx file location is \[code\]http://localhost/cp/list.aspx\[/code\] then hyperlinks location is something like this: \[code\]http://localhost/cp/myfile.jpg\[/code\] since the file location is \[code\]http://localhost/images/myfile.jpg\[/code\] .
How can I fix it?
 
Back
Top