javascript - Open a popup containing ASPX postback result -
I have an ASPX page that produces PDF documents with multiple fields when I use the "export to PDF" button I click on
Now I want a "Print PDF" button in Javascript which does something like this:
w = window.open (?); W.print (); W.close (); Where "?" will do the same postback in my "export pdf" button.
If you have to submit your form in a new window, you try to change the duplicate form target Such as:
Var form = $ ("form"); Form.attr ("target", "__foo"); Submit a form.
form.submit (); Remove the target (Settimet (, 1) - Event at the end of the "Event-Q", in our case - after submitting the form):
setTimeout (function () {form.removeAttr ("target");}, 1); Also, before you can try opening the window with __foo id for more style, and a new form (postback) will be submitted in this window instead of the new one. :
var wnd = window.open ('', '__foo', 'width = 450, height = 300, condition = yes, resizable = yes, scrollbars = yes'); But I do not know how to handle the submitted window and catch up with the download or JPY ready program. If you can do this, please share the solution and click on wnd. Print (); You can play with the iframes within this wnd and maybe you will find a solution.
Renewed:
Try looking into this prototype [test in Chrome]:
gt; & lt; / head & gt; & lt; b D & gt; form id = "form1" runat = "server" & gt; & lt; div & gt; & lt; asp: button runat = "server" id = "report button" OnClick = "ReportRenderClick" text = "Export to PDF" OnClientClick = "PrintResult ()" /> & lt; ASP: Button Runat = "Server" text = "Just a Button." / / Gt; & lt; / div & gt; Lt; / Form & gt; & lt; / body & gt; & lt; / html & gt; And here is the .cc file:
Public partial squared default: system Web.UI.Page {Secure Zero Page_load (Object Sender, EventArgs E) {} Protected Zero ReportRenderClick (Object Sender, EventArgs e) {Response.Clear (); Thread.Sleep (2000); Response.ContentType = "Apps / PDF"; Response.WriteFile ("D: \\ 1.pdf"); //Response.ContentType = "image / jpeg"; //Response.WriteFile("d:\\1.jpg "); //Response.Write("Hello "); Response.End (); }}
Comments
Post a Comment