打印GridView的内容 [英] print the contents of a gridview
本文介绍了打印GridView的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想以表格格式打印网格的详细信息,还包括标题和所有内容,请解决方案的朋友帮我解决问题.
i want to print a details of a grid in table format and also it includes heading and all, help me out with solutions friends
推荐答案
检查这些链接. .
使用分页打印GridView [ http://sodeve.net/2007/08/printing-the-content-of-gridview / [ ^ ]
希望对您有所帮助.
check these links..
Printing a GridView with Paging[^]
http://sodeve.net/2007/08/printing-the-content-of-gridview/[^]
hope this helps..
使用此javascript:
Use this javascript :
<script language="javascript" type="text/javascript">
function Clickheretoprint() {
var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
disp_setting += "scrollbars=yes,width=650, height=600, left=100, top=25";
var content_vlue = document.getElementById('<%=dvPrintXL.ClientID %>').innerHTML;
var docprint = window.open("", "", disp_setting);
docprint.document.open();
docprint.document.write('<html><head><title>Stock Statement</title>');
docprint.document.write('</head><body><center>');
docprint.document.write(content_vlue);
docprint.document.write('</center></body></html>');
docprint.print();
docprint.document.close();
docprint.focus();
}
</script>
//在.aspx页面上:
//on .aspx page :
<a href="#" onclick="javascript:Clickheretoprint();">
<img alt="Print" src="../Images/print.gif" style="border: none" /></a>
//在.cs页面上:
//on .cs page :
public override void VerifyRenderingInServerForm(Control control)
{
// Confirms that an HtmlForm control is rendered for the
}
希望对您有帮助.
如果有帮助,请不要忘记将其标记为答案. :)
Hope this will help you.
Don''t forget to mark as answer if it helps. :)
试试这个:
Hi,
Try to this one:
<script language="javascript">
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=0,top=0,width=800,height=400,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
</script>
<asp:imagebutton id="imbtnPrint" runat="server" height="35px" imageurl="~/images/icon_print.png" width="45px" onclientclick="javascript:CallPrint('divprint')" xmlns:asp="#unknown" />
<div id="divprint">
//put here gridview
</div>
这篇关于打印GridView的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文