Asp.net Hyperlink brings complete file path with server -
i have next asp:hyperlink in page
<asp:hyperlink runat="server" cssclass="blueii_left" target="_blank" navigateurl='<%#eval("rutacompleta")%>' text='<%#eval("archivo")%>' > </asp:hyperlink>
the problem when "rutacompleta" gets evaluated brings like:
localhost:62997/someroute/\\complete file path.
instead of bringing
\\complete file path
any ideas???
thanks in advance
i think know trying do, have application shows archive list , each item in list direct link pdf file
this how setup links
<asp:hyperlink id="hyperlink2" runat="server" navigateurl='<%# string.format("~/invoices/{0}.pdf",eval("number")) %>' text='<%# eval("number") %>' target="_blank"></asp:hyperlink>
this gets rendered:
<a id="gvinvoices_ctl00_ctl06_hyperlink2" target="_blank" href="invoices/8096.pdf">8096</a>
if doesn't show me gets rendered , 'rutacompleta' from
add code .cs file use linkbutton
using system.diagnostics; //add public void openfile(string _uri) { process.start(@_uri.tostring()); //use @ use string is. } protected void linkbutton1_command(object sender, commandeventargs e) { openfile(e.commandargument.tostring()); }
you can generate linkbutton either programatically end or front end. example front end since using:
<asp:linkbutton id="linkbutton1" runat="server" commandargument="\\server\data\file.xls" oncommand="linkbutton1_command">linkbutton</asp:linkbutton>
have in mind since uses process property of server going use amount of resources, simple local application going fine if want implement @ larger scale going have beef server.
i tested solution , opens files local computer , server
Comments
Post a Comment