asp.net 代码实现打印功能
2011-08-28 20:03
471 查看
一.在服务器端实现
1.这个是在本页面上的.cs文件里写的
if (resultInt > 0)
{
//清除验证码 ,显示执行结果,并转向新的地址
Session["YanZhengMa"] = "";
String caoCode = "if(confirm('提交成功,是否打印'))" +
"{" +
"window.location.href='printTKZ.aspx?type=BF&BMId=" + _flowidValue +"&bufeitime="+ _jfTimeValue +"&palJE="
+_shouXianValue + "&goTo=buFeiList.aspx';" +
"}" +
"else" +
"{" +
"window.location.href='buFeiList.aspx';" +
"}";
MessageBox.alert(Page, (object)caoCode);
}
2.在你想要的打印 printTKZ.aspx这个页面上写上
就可以了
二.在客户端实现
function doPrint() {
bdhtml=window.document.body.innerHTML;
sprnstr=" ";
eprnstr=" ";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
}
放在打印地方的开头
打印地方的结尾
打 印
1.这个是在本页面上的.cs文件里写的
if (resultInt > 0)
{
//清除验证码 ,显示执行结果,并转向新的地址
Session["YanZhengMa"] = "";
String caoCode = "if(confirm('提交成功,是否打印'))" +
"{" +
"window.location.href='printTKZ.aspx?type=BF&BMId=" + _flowidValue +"&bufeitime="+ _jfTimeValue +"&palJE="
+_shouXianValue + "&goTo=buFeiList.aspx';" +
"}" +
"else" +
"{" +
"window.location.href='buFeiList.aspx';" +
"}";
MessageBox.alert(Page, (object)caoCode);
}
2.在你想要的打印 printTKZ.aspx这个页面上写上
就可以了
二.在客户端实现
function doPrint() {
bdhtml=window.document.body.innerHTML;
sprnstr=" ";
eprnstr=" ";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
}
放在打印地方的开头
打印地方的结尾
打 印
相关文章推荐
- ASP.NET 水晶报表打印功能实现代码
- 代码实现打印功能(asp.net+javascript)
- 代码实现打印功能(asp.net+javascript)
- asp.net实现打印功能代码
- ASP.NET 水晶报表打印功能实现代码
- asp.net 代码实现打印功能
- Asp.net 2.0 自定义控件开发[实现自动计算功能(AutoComputeControl)][示例代码下载]
- Asp.net 2.0 自定义控件开发[实现自动计算功能(AutoComputeControl)][示例代码下载]
- Asp.net 2.0 自定义控件开发[实现自动计算功能(AutoComputeControl)][示例代码下载]
- Asp.net实现在线人数统计功能代码实例
- asp.net导出excel-一行代码实现excel、xml、pdf、word、html、csv等7种格式文件导出功能而且美观-SNF快速开发平台
- Asp.net(C#)实现验证码功能代码
- 分享ASP.NET使用Lodop控件实现Web打印功能
- C# ASP.NET 最常用的通用权限的3个方法例子展示(每个功能一行代码实现)
- asp.net中用dropdownList实现查询功能代码
- asp.net实现页面的局部打印功能实现
- Asp.net 2.0 C#实现压缩/解压功能 (示例代码下载)
- Asp.net 2.0 C#实现压缩/解压功能 (示例代码下载)
- Asp.net 2.0 自定义控件开发[实现自动计算功能(AutoComputeControl)][示例代码下载]