Solved view pdf in new window

Posted on 2014-09-29
Last Modified: 2014-10-03
I am trying to get a pdf that is saved in the web directory ~/documents/test.pdf to open up in a new window.

I have hyperlinks that have different documents associated with them and I want them to open a new window with the PDF upon being clicked.

I am having much trouble figuring this out.

Doing this in c#
Question by:desiredforsome
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 18

Expert Comment

by:Jerry Miller
ID: 40350040
I am using something similar to this to open new windows, though I couldn't find my code that is doing this.

Author Comment

ID: 40350439
Hmm, does not seem to work well for me.
LVL 18

Expert Comment

by:Jerry Miller
ID: 40350578
When you say does not seem to work well, are you getting errors or what is it doing as you step through the code?

I found that I am using this in VB and it works fine.

ClientScript.RegisterStartupScript(Page.[GetType](), Nothing, "'PrntMan.aspx', '_blank')", True)

I believe the C# equivalent would be:

ClientScript.RegisterStartupScript(this.GetType(), Nothing, "'PrntMan.aspx', '_blank')", True)
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 40350693
So Do I need to put the pdf in the web page?
LVL 18

Expert Comment

by:Jerry Miller
ID: 40350814
No, the link is only an example. Replace 'PrntMan.aspx' with your document name.

ClientScript.RegisterStartupScript(this.GetType(), Nothing, "'~/documents/test.pdf', '_blank')", True)

Author Comment

ID: 40350970
hmm it seems to work but i dont want the pdf location to be displayed in the url. Is there a way I can load it into a panel or some type of control ont he web page?

I was going to request parameters and then run a sql query against it o get the file location and open it in the backend.
LVL 18

Accepted Solution

Jerry Miller earned 500 total points
ID: 40351060
You could try opening them in Adobe Reader instead of the browser:

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL ( and MongoDB (…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question