tags:

views:

19

answers:

1

Hello,

I have pdf that I would like to open from ASP.net project. I don't want to nagivate to the pdf, but i want to keep the current page opened but when a user clicks on the link, i want to open the pdf file in another page.

Thanks for your help.

+2  A: 

You could open the PDF in a new window:

 <asp:HyperLink  Target="_blank" runat="server" ID="linkBarPdf" Text="Open Bar PDF"
                 NavigateUrl="~/foo/bar.pdf">

This won't host the PDF though, but rather serve up the file for execution by the local machine's viewer. That COULD be a browser plug-in, or it could be outside of the browser.

p.campbell
you can also do this with a straight up HTML hyperlink and avoid the <asp:HyperLink> wrapper object.
Visionary Software Solutions
@Visionary: indeed. I figured I'd give an ASP.NET solution rather than an HTML-only. Perhaps there is some code-behind involved here, and perhaps some reliance on viewstate.
p.campbell
Great, thanks it works.
tony