A ABC Mar 27, 2006 #1 I want click a button and than to popup window which will show my one PDF file. How should I to coding in C#?
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 Mar 27, 2006 #3 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]
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 Mar 27, 2006 #4 I want click a button and than to popup window which will show my one PDF file. How should I to coding in C#? Click to expand... 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
I want click a button and than to popup window which will show my one PDF file. How should I to coding in C#? Click to expand... 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