Is there a way to open a PDF file from a remote server directory inside a gridview using NavigateUrl? I'm able to retrieve the file number from the textbox and generate the link, but when you click on the link nothing happens. Could my NavigateUrl be formatted wrong due it being on a remote server and trying to open in a web browser? My code below. Thanks in advance.
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl='<%# Eval("Name", "file:\\fileserver\pdf\{0}") %>'
Target="_blank" Text='<%# Eval("Name", "{0:d}") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Name" DataFormatString="{0:d}" HeaderText="FILE NUMBER" />
<asp:BoundField DataField="CreationTime" DataFormatString="{0:d}" HeaderText="DATE ADDED" />
<asp:BoundField DataField="Length" DataFormatString="{0:#,### bytes}" HeaderText="FILE SIZE" />
You will need to have the file accessible via http:// and not file:// in order for the the link to work properly.
Once that is set, use the Server.MapPath() method to generate the URL based on the path to your file.