How to popup window which will show my one PDF file?

A

ABC

I want click a button and than to popup window which will show my one PDF
file. How should I to coding in C#?
 
K

Ken Cox - Microsoft MVP

Try this in ASP.NET 2.0?

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript
(this.GetType(), "pdf", "window.open('http://research.microsoft.com"
+
"/~awilson/papers/Wilson%20PlayAnywhere%20UIST%202005.pdf');", true);
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:button id="Button1" runat="server" onclick="Button1_Click"
text="Button" /></div>
</form>
</body>
</html>

Let us know if it helps?

Ken
Microsoft MVP [ASP.NET]
 
H

Hans Kesting

I want click a button and than to popup window which will show my one PDF
file. How should I to coding in C#?

for a Save/Open dialog:


Response.Clear();
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment;
filename=myfile.pdf");

Response.WriteFile(myfile); // supply local path to physical file
// OR: Response.BinaryWrite(pdf); // Byte[] pdf

Response.End();



Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top