打印aspx页面的内容 [英] to print the content of an aspx page

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

问题描述

我想使用打印机打印aspx页面的内容.您能为此提供解决方案吗.........
您可以提供整个代码来执行此操作吗?...

I want to print the content of an aspx page using a printer. Can you provide solution for this..........
Can u give the entire code to do this....

推荐答案

在Javascript中有一个打印方法,您几乎可以做到.
there''s a print method in Javascript,that''s about all you can do.


看看这篇文章:
如何在ASP.NET 2.0中打印 [
Have a look at this article:
How to Print in ASP.NET 2.0[^]


我有这个需要对此进行编码.但是,上面的两个"解决方案是我发现这样做的唯一方法.问题出在视图状态"附近.页面加载后,将设置视图状态,并且如果用户需要填写某些项目,然后您希望允许它们打印,哎呀,您就拥有了视图状态陷阱.因此,要在页面加载后并在用户填写一些表单数据后打印页面,那么.
1.将页面放在那里供用户输入.
2.使用postbackurl打印按钮调用asp页面. target = _blank,弹出一个窗口.
3.在该新页面加载中,使用previous.page填写数据.
4.从这里您可以使用所需的任何方法,例如解决方案2中的ASP文章,也可以使用解决方案1中的JavaScript document.print().对于这两者,您都希望在页面的body标签中有一个"onload print call".

某种涉及,问题源于页面加载后的"viewstate".您可能可以编写一些代码来更改所有项目的viewstate值,但是,破解者的时间比我现在要多.
I have this need to code this. However, the "two" solutions above are about the only way I have found to do this. The problem stems around the "viewstate". Once a page loads the view state is set, and if a user needs to fill out some items and then you want to allow them to print, oops, you have a view state gotcha. So for printing a page after page load, and after a user fills in some form data, then.
1. Put your page out there for user to input.
2. Print button calls asp page using postbackurl. target = _blank, making a popup.
3. On that new page load, use previous.page to fill in the data.
4. From here you can use any method you want, Like that ASP article in Solution #2 or you can use the JavaScript document.print() like Solution #1. And for both you want to have a "onload print call" in the body tag of the page.

Kind of involved, the problem stems from the "viewstate" after a page loads. You could probably code something to change viewstate values of all your items, but, crackers, that would be more time than I have right now.


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

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