如何在按钮点击时打印两个文件? [英] How to print two documents on button click?

查看:82
本文介绍了如何在按钮点击时打印两个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个代码,当用户点击提交按钮时,数据会被提交到数据库,并且应该弹出两个CR查看器进行打印。现在只有一个弹出。我的代码中需要什么才能让CR查看器弹出以进行打印?



I have a code that when a user clicks on submit button the data is submitted to the database and two CR viewer should popup for printing. Right now only one pops up. What do I need in my code to have both CR viewer to popup for printing?

if (Page.IsValid)
            {
                TextBoxUser_ID.Text = Session["user_id"].ToString();
                ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script language=javascript>window.open('ReportFormFTE.aspx','PrintMe','height=650px,width=950px,scrollbars=1');</script>");
                ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script language=javascript>window.open('ReportFormGrad.aspx','PrintMe','height=650px,width=950px,scrollbars=1');</script>");
                ScriptManager.RegisterStartupScript(this, typeof(Page), "myscript", "alert('You have successfully submitted the electronic portion of the General and Enrollment Profile.  Please send your signed Profile along with any required attachments to SACSCOC, Attn: Profiles, 1866 Southern Lane, Decatur, Ga 30033.');location.href='WelcomeMenu.aspx';", true);
            }
        }

推荐答案

首先摆脱你的IF / ELSEIF语句。在调试中逐步执行代码时,您将看到它只执行IF部分中的代码,并且永远不会执行ELSE IF部分中的代码。



如果这不起作用,请尝试以不同方式命名窗口。目前,您将它们命名为PrintMe。将其中一个更改为PrintMe2或其他内容,看看是否有效。







- --------编辑----------

好​​的...现在我在想它是因为你正在创建两个OnClick事件。你可以在一个方法中为两个window.open调用放置javascript,然后在OnClick事件中调用该方法吗?



这是一个链接到一个样本的链接我发现:

http://www.java2s.com/Code /JavaScript/Window-Browser/Openmultiplewindowsatoneclick.htm [ ^ ]



以下是其他一些可能有用的谷歌搜索结果:

https ://www.google.com/webhp的SourceID =铬瞬间&安培; RLZ = 1C1EODB_enUS581US581&安培;离子= 1&安培; espv = 2和,即= UTF-8#q =的JavaScript + window.open +多个+窗口? [ ^ ]
First get rid of your IF/ELSEIF statement. When stepping through the code in debug you will see that it will only execute the code in the IF portion, and will never execute the code in the ELSE IF portion.

If that doesn't work, try naming the windows differently. Currently you are naming them both "PrintMe". Change one of them to "PrintMe2" or something and see if that works.



---------- Edit ----------
Okay...now I'm thinking it's because you are creating two OnClick events. Can you put the javascript for both window.open calls in a method and then just call that method in the OnClick event?

Here is a link with to a sample that I found:
http://www.java2s.com/Code/JavaScript/Window-Browser/Openmultiplewindowsatoneclick.htm[^]

And here are some other google results that may help:
https://www.google.com/webhp?sourceid=chrome-instant&rlz=1C1EODB_enUS581US581&ion=1&espv=2&ie=UTF-8#q=javascript+window.open+multiple+windows[^]


我自己解决了。我刚刚将其他报告添加为子报告。
I solved it myself. I just added the other report as a subreport.


这篇关于如何在按钮点击时打印两个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆