我如何在asp.net中执行打印功能,我需要从表单1打印按钮打印form2数据 [英] How do i do a print function in asp.net , i need to print form2 data from form 1 print button

查看:81
本文介绍了我如何在asp.net中执行打印功能,我需要从表单1打印按钮打印form2数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

form1.axpx



我有打印按钮。



form2.aspx



我有一个

form1.axpx

I have print button .

form2.aspx

I have a

<asp:Label ID="Label1" runat="server" Text="name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>





如果用户点击打印表单1中的按钮我需要打印aspx2数据。



我尝试过:





If user clicks print button from form 1 I need to print aspx2 data.

What I have tried:

   <script type="text/javascript">
         function PrintPage() {
             if (window.confirm("will you print his page?")) {
                 window.print();
             }
             //dosomething();}
            
         }
</script>

推荐答案

我没有得到正确的你想要做什么的想法。但是,我建议一个解决方案。



您不需要拥有表格2.假设您没有向用户显示表格2,您可以在文本框和标签中找到同样从1开始隐藏它们。因此,当您点击按钮时,您可以打印隐藏的部分(标签和文本框)JS和CSS媒体查询(在CSS媒体查询上搜索互联网)。



如果有帮助请告诉我。
I'm not getting the correct idea of what you are trying to do. But let me suggest a solution.

You don't need to have Form 2. Assuming that you are not showing the Form 2 to the user, you can have the text box and the label in the same from 1 and hide them. So when you hit the button, you can print that hidden part (label and the text box) JS and CSS Media Queries (Search internet on the CSS Media Queries).

Please let me know if this helps.


这篇关于我如何在asp.net中执行打印功能,我需要从表单1打印按钮打印form2数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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