主题:[讨论]调用IE打印多页GridView,高分寻求可行解决方案!UP有分!
我做了个调用IE打印的功能,但是只能实现打印当前页面,我希望可以一次打印出GridView中所有的记录.页面代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="print.aspx.cs" Inherits="print" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<style media=print>
.noPrint{display:none;}
.PageNext{page-break-after: avoid; page-break-before: avoid;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<input class="noPrint" type="button" value="打印预览" onclick="javascript:document.all.WebBrowser.ExecWB(7,1);this.style.display='none'">
</p>
<BR>
<asp:GridView ID="GridView1" runat="server" Height="176px" Width="553px" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging">
</asp:GridView>
</div>
</form>
</body>
</html>
后台只是绑定了GridView和一个分页功能,代码不帖出来了.
欢迎大家踊跃讨论,UP有分,送完为止!
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="print.aspx.cs" Inherits="print" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<style media=print>
.noPrint{display:none;}
.PageNext{page-break-after: avoid; page-break-before: avoid;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>
<input class="noPrint" type="button" value="打印预览" onclick="javascript:document.all.WebBrowser.ExecWB(7,1);this.style.display='none'">
</p>
<BR>
<asp:GridView ID="GridView1" runat="server" Height="176px" Width="553px" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging">
</asp:GridView>
</div>
</form>
</body>
</html>
后台只是绑定了GridView和一个分页功能,代码不帖出来了.
欢迎大家踊跃讨论,UP有分,送完为止!