I have a report viewer in a webform.aspx and to avoid showing the preview when printing, add a button to which I added this script:
<script type="text/javascript">
function Print() {
var report = document.getElementById("<%=ReportViewer1.ClientID%>");
var div = report.getElementsByTagName("DIV");
var reportContents;
for (var i = 0; i < div.length; i++) {
if (div[i].id.indexOf("VisibleReportContent") !== -1) {
reportContents = div[i].innerHTML;
break;
}
}
var frame1 = document.createElement('iframe');
frame1.name = "frame1";
frame1.style.position = "absolute";
frame1.style.top = "-1000000px";
document.body.appendChild(frame1);
var frameDoc = frame1.contentWindow ? frame1.contentWindow : frame1.contentDocument.document ? frame1.contentDocument.document : frame1.contentDocument;
frameDoc.document.open();
frameDoc.document.write(reportContents);
frameDoc.document.close();
setTimeout(function () {
window.frames["frame1"].focus();
window.frames["frame1"].print();
document.body.removeChild(frame1);
}, 500);
}
</script>
The problem is that I only print the current page where the report viewer is located and I have to change the page to print the rest in this section. How do I print them all together without changing the page?
I mean do not change pages in this section:
I hope you made me understand.