打印ASP.Net页面的代码 [英] Code to print an ASP.Net Page

查看:65
本文介绍了打印ASP.Net页面的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

是否有代码在其中打印asp.net pagem或其中的一些文本?

谢谢:)

Hello

is there a code to print an asp.net pagem or some text in inside it ?

thank you : )

推荐答案

打印网页-任何网页-都由浏览器处理.它无法在服务器端完成,因此没有可用的C#或.Net方法.

Javascript和其他浏览器端脚本工具中的方法可以让您的用户进行打印.这些会导致浏览器显示选择打印机"对话框,并且在没有用户干预的情况下不能用于自动打印页面.
Printing a web page -- any web page -- is handled by the browser. It cannot be done server-side, so there are no C# or .Net methods available for doing this.

There are methods in Javascript and other browser-side scripting tools that will allow your user to print. These cause the browser to display a "select printer" dialog and cannot be used to automatically print a page without the user''s intervention.


您可以使用按钮进行操作:
you can do it with a button:
<asp:button id="printButton" runat="server" text="Print" onclientclick="javascript:window.print();" xmlns:asp="#unknown" />


这篇关于打印ASP.Net页面的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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