打印后如何关闭asp.net中的窗口 [英] After Print how to close window in asp.net
本文介绍了打印后如何关闭asp.net中的窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要打印页面,我在asp.net中使用了JavaScript的window.print()在后面的代码中.但是我想在打印命令后关闭当前窗口.
To print page I have Used window.print() of JavaScript in asp.net in code behind. However I want to close current window after print command.
推荐答案
选中此
打印对话框关闭后自动关闭窗口 [
Check this
Close window automatically after printing dialog closes[^]
您可以使用javascript的window.close函数关闭当前窗口
You can Use window.close function of javascript to close the current window
我找到一个解决方案self.close().在Firefox中可以正常工作,但在IE中则不能.
示例:-
I find one solution self.close(). It work fine in Firefox but not in IE.
Example:-
ClientScript.RegisterStartupScript(typeof(Page), "PrintPage", "window.print();", true);
ClientScript.RegisterStartupScript(typeof(Page), "closePage", "self.close();", true);
这篇关于打印后如何关闭asp.net中的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文