How to get Print dialog using JavaScript in ASP.net Page
Hello, and very Good Morning to all.
Today, I am going to show you a simple and quicker way to get a Print Dialog Box on your ASP.Net page via JavaScript. Just follow the code given below:
Today, I am going to show you a simple and quicker way to get a Print Dialog Box on your ASP.Net page via JavaScript. Just follow the code given below:
<html >
<head>
<title>Untitled Document</title>
<script language="javascript"
type="text/javascript">
function
check_print()
{
var
status;
//This statement opens the PRINT Dialog Box for Active //Browser Window
window.print()
;
//This Statement stores the status of user response for PRINT //Dialog Box
status= window.confirm("Are you Sure You don't
want to Print");
// This IF checks whether user has chosen YES to print or not
if
( status)
{
alert("Printing
Aborted");
window.close();
}
}
</script>
</head>
<body>
<input type="text" id="t1" />
<input type="button" id="b1"
value="Print" onClick="check_print();"/>
</body>
</html>
Your Page will look something like shown below:
On clicking the PRINT button , you will get a print window something like this:
This is a simple illustration to show you how to get print dialog box, you may use this code in combination with your Web Page code to work perfectly
That's All


Comments
Post a Comment