如何在asp.net中打印 [英] How to print in asp.net

查看:86
本文介绍了如何在asp.net中打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做Restarunt项目。我想点击网页上的按钮打印比尔。请打印任何简单的想法。谢谢



我在使用Asp.net时使用C#

解决方案

在asp.net中打印


尝试

http://www.dotnetcurry.com/ShowArticle.aspx?ID=92 [ ^ ]

在ASP.NET中动态创建打印预览页面 [ ^ ]

http://forums.asp.net/p/1561011/3861081.aspx [ ^ ]


使用此脚本
1)



 <   script     language   =  javascript    type   =  text / javascript >  
函数CallPrint(strid){
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf = 0,top = 0,width = 1,height = 1,toolbar = 0,scrollbars = 0,status = 0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML = strOldOne;
}
< / script >



2)

 <   div     id     =  bill >  
<% - 将打印内容 - %>





 3)调用函数



< asp:button id =   BtnPrint runat =   server text =  < span class =code-string> Print onclientclick =   javascript:CallPrint('bill'); xmlns:asp =  #unknown /> 
< / div >


I am doing Restarunt project. I want to print Bill when i click the button onthe webpage.Please any simple idea for print. Thank you

I am using Asp.net with C#

解决方案

Printing in asp.net


Try
http://www.dotnetcurry.com/ShowArticle.aspx?ID=92[^]
Creating print preview page dynamically in ASP.NET[^]
http://forums.asp.net/p/1561011/3861081.aspx[^]


use this script 
1)


<script language="javascript" type="text/javascript">
    function CallPrint(strid) {
        var prtContent = document.getElementById(strid);
        var WinPrint = window.open('', '', 'letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
        WinPrint.document.write(prtContent.innerHTML);
        WinPrint.document.close();
        WinPrint.focus();
        WinPrint.print();
        WinPrint.close();
        prtContent.innerHTML = strOldOne;
    }
</script>


2)

<div id ="bill">
<%-- the content will be printed --%>.



3)call the Function 


<asp:button id="BtnPrint" runat="server" text="Print" onclientclick="javascript:CallPrint('bill');" xmlns:asp="#unknown" />
</div>


这篇关于如何在asp.net中打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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