如何为aspx应用程序添加打印按钮 [英] how to add print button for aspx application

查看:70
本文介绍了如何为aspx应用程序添加打印按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做结果出版学术项目。我想使用打印按钮打印收到的结果。点击打印按钮结果表必须打印。请打印任何简单的想法。请分享.aspx中的代码谢谢

解决方案

使用窗口print()方法 [ ^ ]

DEMO [ ^ ]



window.print使用asp.net按钮:

 <   asp:按钮    ID   =  printButton    runat   =  server   文字  = 打印     OnClientClick   = < span class =code-keyword> javascript:window.print();    /  >  


用户的浏览器上已经有一个打印按钮,你没有需要提供一个。



如果您想要类似打印预览的内容,那么您可以使用css媒体查询将打印样式表应用到页面并使用window.print调用打印对话



http:// www.granneman.com/webdev/coding/css/printfriendlythemcvicarmet/ [ ^ ]



http://www.htmlgoodies.com/beyond/javascript/article.php/3471121 [ ^ ]



预先设定下一个问题,没有你不能打印而不要求用户确认。


你可以在这里找到解决方案

http://stackoverflow.com/questions/16033634 /如何对打印部分的最页入-ASP-净

I am doing Result publication academic project. I want to print the received result using print button. on clicking print button result form must be printed.Please any simple idea for print. kindly share the code in .aspx Thank you

解决方案

use Window print() Method[^]
DEMO[^]

window.print with asp.net button:

<asp:Button ID="printButton" runat="server" Text="Print" OnClientClick="javascript:window.print();" />


The user already has a print button on their browser, you don't need to supply one.

If you want something like a print-preview then you can use css media queries to apply a print stylesheet to the page and use window.print to invoke the print dialogue

http://www.granneman.com/webdev/coding/css/printfriendlythemcvicarmet/[^]

http://www.htmlgoodies.com/beyond/javascript/article.php/3471121[^]

To pre-empt your next question, no you can't print without asking the user to confirm.


You can find the solution here
http://stackoverflow.com/questions/16033634/how-to-print-part-of-the-page-in-asp-net


这篇关于如何为aspx应用程序添加打印按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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