How to Print Div in Asp.net Programming by javaScript
How to Print Div in Asp.net Programming by java Script
Print Div in asp.net is use when the developer want to print a particular part of web page.we can use java script for this work.the code is given here.....
var divToPrint = document.getElementById('MYDIV');
var popupWin = window.open('', '_blank', 'width=700,height=500');
popupWin.document.open();
popupWin.document.write('<html><head><title>Student Attendance
Report</title><body onload="window.print()">' + divToPrint.innerHTML +
'</html>');
JavaScript code for Print button:
<script type="text/javascript"
language="javascript">
function PrintDiv()
{
var divToPrint =
document.getElementById('MYDIV');
var popupWin = window.open('', '_blank',
'width=700,height=500');
popupWin.document.open();
popupWin.document.write('<html><head><title>Student
Attendance
Report</title><body
onload="window.print()">' + divToPrint.innerHTML +
'</html>');
popupWin.document.close();
}
</script>
|
Print button:
<input id="btnPrint" runat="server" type="button" value="Print" visible="false" nclick="PrintDiv()" />
DIV:
<div id="MYDIV">
</div>
|
Other Asp.net Related Post:
- How to Achieve Many Selection in Drop Down List
- Create data Table Dynamically and bind to Drop down List in asp.net
- Sending mail from web application using google Mail ID
- Display selected Date from data base into asp.net calendar
- How to Make a HTML Table by C# code in asp.net programming
- How to Calculate Number of Sunday in a particular month by asp.net programming.
- How to Print Div in Asp.net Programming by javaScript
- How to Make Data Table By C# code in Asp.net Programming:
- how to add capcha in Asp.net programming
- Example of Crystal report(Crystal_report_in asp.net programming )
- How To bind RadioButtonList Control From data base
- Access RadioButtonList Item Using VBScript
- Use radiobuttonlist with VB
- Example of RadioButtonList control.
- Html Radio Button
- ASP.NET RadioButton Control
- Hide radio buttons in JavaScript on button click