如何在c#windows应用程序中打印Datagridview [英] how to print Datagridview in c# windows application
本文介绍了如何在c#windows应用程序中打印Datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何打印datagridview值和文本框值?
How to print datagridview value and textbox value ?
推荐答案
用于打印您可以使用的文本框值
Response.Write(txtdemo.Text);
要打印gridview,您需要这样做:
在页面上放一个html按钮,说明打印并将其绑定到一个javascript函数然后让该函数打开一个新窗口并将gridview写入它然后打印? br />
Hi,
For printing the textbox value you can use
Response.Write(txtdemo.Text);
For printing the gridview you need to do like this:
put an html button on that page that says print and tie it to a javascript function then have that function open a new window and write the gridview to it then print?
<input id="prtButton" type="button" value="Print" onclick="CallPrint('<%= GridView1.ClientID %>');" />
<script language="javascript" type="text/javascript">
function CallPrint( strid )
{
var prtContent = document.getElementById( strid );
var WinPrint = window.open('', '', 'left=0,top=0,width=1050,height=600,toolbar=1,scrollbars=1,status=0');
WinPrint.document.write( prtContent.innerHTML );
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
</script>
谢谢
Thanks
DataGrid Printing Class V1.0b [ ^ ]
http://csharp.net-informations.com/datagridview/csharp-datagridview-printing.htm [ ^ ]
在C#.NET 2.0中打印datagridview [ ^ ]
这篇关于如何在c#windows应用程序中打印Datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文