这段打印代码在web表单中怎么使用,为什么我得页面datagrid加载数据后,就会提示教本错误,代码就不能用了。
其实只要是在页面上一移动这几个按钮的位置,代码就不能用了!
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media="print">
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
<style>
.tdp
{
border-bottom: 1 solid #000000;
border-left: 1 solid #000000;
border-right: 0 solid #ffffff;
border-top: 0 solid #ffffff;
}
.tabp
{
border-color: #000000 #000000 #000000 #000000;
border-style: solid;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 1px;
border-left-width: 1px;
}
.NOPRINT {
font-family: "宋体";
font-size: 9pt;
} </style>
<center class="Noprint">
<p>
<OBJECT id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
width="0">
</OBJECT>
<input type="button" value="打印" onclick="document.all.WebBrowser.ExecWB(6,1)"> <input type="button" value="直接打印" onclick="document.all.WebBrowser.ExecWB(6,6)">
<input type="button" value="页面设置" onclick="document.all.WebBrowser.ExecWB(8,1)">
</p>
<p>
<input type="button" value="打印预览" onclick="document.all.WebBrowser.ExecWB(7,1)">
<br />
</p>
<hr align="center" width="90%" size="1" noshade>
</center>
其实只要是在页面上一移动这几个按钮的位置,代码就不能用了!
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media="print">
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
<style>
.tdp
{
border-bottom: 1 solid #000000;
border-left: 1 solid #000000;
border-right: 0 solid #ffffff;
border-top: 0 solid #ffffff;
}
.tabp
{
border-color: #000000 #000000 #000000 #000000;
border-style: solid;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 1px;
border-left-width: 1px;
}
.NOPRINT {
font-family: "宋体";
font-size: 9pt;
} </style>
<center class="Noprint">
<p>
<OBJECT id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
width="0">
</OBJECT>
<input type="button" value="打印" onclick="document.all.WebBrowser.ExecWB(6,1)"> <input type="button" value="直接打印" onclick="document.all.WebBrowser.ExecWB(6,6)">
<input type="button" value="页面设置" onclick="document.all.WebBrowser.ExecWB(8,1)">
</p>
<p>
<input type="button" value="打印预览" onclick="document.all.WebBrowser.ExecWB(7,1)">
<br />
</p>
<hr align="center" width="90%" size="1" noshade>
</center>
解决方案 »
- 不能操作解决方案的前提下,如何在aspx页面加载一个dll文件.
- 求助 获取asp.net控件的实际位置或屏幕实际位置
- 点击一文件时,若是匿名用户,则被重定向到登陆页面,该怎么做?
- 不显示删除回复显示所有回复显示星级回复显示得分回复 如何用数据库的日志文件恢复数据库删掉的字段?
- 项目开发的书
- 请问asp能否动态生成标签?
- 关于从网站上下载文件的问题
- 求存储过程的详细注解!师傅给我的作业,要我看懂,但是我太菜!谢谢大家了
- 求助 用asp .net显示查询数据库后的结果
- base64解码后乱码的问题
- 一个网页实现excel上传功能,再读入dataset,但无法后退,why?在线等
- 我从数据库查询两个字段,比如“用户名”、“密码”,用datareader读取,我该怎么分别引用这两个字段??
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm3.aspx.vb" Inherits="blogger.WebForm3"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>评议号打印</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media="print">.Noprint {
DISPLAY: none
}
.PageNext {
PAGE-BREAK-AFTER: always
}
</style>
<style>
.tdp { BORDER-RIGHT: #ffffff 0px solid; BORDER-TOP: #ffffff 0px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid }
.tabp { BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid }
.NOPRINT { FONT-SIZE: 9pt; FONT-FAMILY: "宋体" }
</style>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<center class="Noprint">
<p>
<OBJECT id="WebBrowser" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">
<PARAM NAME="ExtentX" VALUE="26">
<PARAM NAME="ExtentY" VALUE="26">
<PARAM NAME="ViewMode" VALUE="0">
<PARAM NAME="Offline" VALUE="0">
<PARAM NAME="Silent" VALUE="0">
<PARAM NAME="RegisterAsBrowser" VALUE="0">
<PARAM NAME="RegisterAsDropTarget" VALUE="1">
<PARAM NAME="AutoArrange" VALUE="0">
<PARAM NAME="NoClientEdge" VALUE="0">
<PARAM NAME="AlignLeft" VALUE="0">
<PARAM NAME="NoWebView" VALUE="0">
<PARAM NAME="HideFileNames" VALUE="0">
<PARAM NAME="SingleClick" VALUE="0">
<PARAM NAME="SingleSelection" VALUE="0">
<PARAM NAME="NoFolders" VALUE="0">
<PARAM NAME="Transparent" VALUE="0">
<PARAM NAME="ViewID" VALUE="{0057D0E0-3573-11CF-AE69-08002B2E1262}">
<PARAM NAME="Location" VALUE="res://C:\WINNT\System32\shdoclc.dll/dnserror.htm#http:///">
</OBJECT>
<input type="button" value="打印" onclick="document.all.WebBrowser.ExecWB(6,1)"> <input type="button" value="直接打印" onclick="document.all.WebBrowser.ExecWB(6,6)">
<input type="button" value="页面设置" onclick="document.all.WebBrowser.ExecWB(8,1)">
</p>
<p>
<input type="button" value="打印预览" onclick="document.all.WebBrowser.ExecWB(7,1)">
<br>
</p>
<hr align="center" width="90%" size="1" noshade>
</center>
<FONT face="宋体">
<asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 152px; POSITION: absolute; TOP: 184px"
runat="server" Width="416px" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" BackColor="White"
CellPadding="3">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>
<ItemStyle ForeColor="#000066"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#006699"></HeaderStyle>
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<PagerStyle HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages"></PagerStyle>
</asp:DataGrid>
<asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 152px; POSITION: absolute; TOP: 136px" runat="server">班级:</asp:Label>
<asp:Label id="Label2" style="Z-INDEX: 103; LEFT: 352px; POSITION: absolute; TOP: 136px" runat="server">时间:</asp:Label>
<asp:Label id="Label3" style="Z-INDEX: 104; LEFT: 424px; POSITION: absolute; TOP: 136px" runat="server">Label</asp:Label>
<asp:Label id="Label4" style="Z-INDEX: 105; LEFT: 216px; POSITION: absolute; TOP: 136px" runat="server">Label</asp:Label></FONT></form>
</body>
</HTML>
但是不行
去掉这行即可使用,切记这个代码不要让他自动生成,生成后要及时删除,才可以使用
<PARAM NAME="ExtentX" VALUE="26">
<PARAM NAME="ExtentY" VALUE="26">
<PARAM NAME="ViewMode" VALUE="0">
<PARAM NAME="Offline" VALUE="0">
<PARAM NAME="Silent" VALUE="0">
<PARAM NAME="RegisterAsBrowser" VALUE="0">
<PARAM NAME="RegisterAsDropTarget" VALUE="1">
<PARAM NAME="AutoArrange" VALUE="0">
<PARAM NAME="NoClientEdge" VALUE="0">
<PARAM NAME="AlignLeft" VALUE="0">
<PARAM NAME="NoWebView" VALUE="0">
<PARAM NAME="HideFileNames" VALUE="0">
<PARAM NAME="SingleClick" VALUE="0">
<PARAM NAME="SingleSelection" VALUE="0">
<PARAM NAME="NoFolders" VALUE="0">
<PARAM NAME="Transparent" VALUE="0">
<PARAM NAME="ViewID" VALUE="{0057D0E0-3573-11CF-AE69-08002B2E1262}">
<PARAM NAME="Location" VALUE="res://C:\WINNT\System32\shdoclc.dll/dnserror.htm#http:///">
但是那些代码,在我编译程序以后还会出现的!我想还有没有更好的web打印代码!