<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="test.WebForm2" %>
<!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>Untitled Page</title>
<script type="text/javascript" >
function print() {
var printWindow = window.open('', '', 'status=1,width=800,height=600');
printWindow.document.write(document.getElementById('<%=adityadiv.ClientID%>').innerHTML);
printWindow.document.close();
printWindow.print();
printWindow.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="adityadiv" runat="server">
this is a demo of print button.
in this tutorial we r opening print dailog using javascript.
<ol>
<li>aditya pratap singh</li>
<li>india</li>
<li>lucknow</li>
<li>new delhi</li>
<li>gorakhpur</li>
<li>chennai</li>
</ol>
</div>
<input id="printbtn" type="button" onclick="print()" value="Print" runat="server" alt="Print"/>
</form>
</body>
</html>
<!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>Untitled Page</title>
<script type="text/javascript" >
function print() {
var printWindow = window.open('', '', 'status=1,width=800,height=600');
printWindow.document.write(document.getElementById('<%=adityadiv.ClientID%>').innerHTML);
printWindow.document.close();
printWindow.print();
printWindow.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="adityadiv" runat="server">
this is a demo of print button.
in this tutorial we r opening print dailog using javascript.
<ol>
<li>aditya pratap singh</li>
<li>india</li>
<li>lucknow</li>
<li>new delhi</li>
<li>gorakhpur</li>
<li>chennai</li>
</ol>
</div>
<input id="printbtn" type="button" onclick="print()" value="Print" runat="server" alt="Print"/>
</form>
</body>
</html>
No comments:
Post a Comment