A. Implement on the server side
1. This is written in the. cs file on this page.
Copy Code code as follows:
if (ResultInt > 0)
{
Clears the verification code, displays the execution result, and moves to the new address
session["Yanzhengma"] = "";
String Caocode = "if (Confirm (' submitted successfully, print ')" +
"{" +
"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. On the print printtkz.aspx you want to write on this page
<body onload= "Vbscript:window.print ()" >
It's okay.
Two. On-Client implementation
Copy Code code as follows:
<script language= "JavaScript" >
function Doprint () {
bdhtml=window.document.body.innerhtml;
Sprnstr= "<!--startprint-->";
Eprnstr= "<!--endprint-->";
Prnhtml=bdhtml.substr (Bdhtml.indexof (SPRNSTR) +17);
Prnhtml=prnhtml.substring (0,prnhtml.indexof (EPRNSTR));
window.document.body.innerhtml=prnhtml;
Window.print ();
}
</script>
<!--startprint--> at the beginning of the print place
<!--the end of the endprint--> print place
<a href= "javascript:;" onclick= "Doprint ()" > Print </a>