Print your DIV content in asp.net

Ranjeet_8
Posted by Ranjeet_8 under ASP.NET category on | Points: 40 | Views : 8834
#Print your div content in asp.net.
Add this java script on your web page.

<script language="javascript" type="text/javascript">
function PrintDivContent(strid) {
var prtContent = document.getElementById(strid);
var WinPrint =
window.open('', '', 'letf=0,top=0,toolbar=0,sta­tus=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
}
</script>

Add below code on .ASPX page

<div id="AppPrint">
1. Your Print content here..!<br />
2. Your Print content here..!!<br />
3. Your Print content here..!!!
</div>
<br /> <br />
<asp:Button ID="btnPrint" Text="Print" OnClientClick="javascript:PrintDivContent('AppPrint');"
runat="Server" Width="94px" Height="30px" />

Comments or Responses

Login to post response