jglazer63
asked on
Print a panel in asp.net/vb.net
Is there a quick and dirty way to add a print button to a web form such that it will allow the user to print the contents of just one panel on the form? VB if you please if possible
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nevermind. I worked it out. It seems that even though you ID the panel as "Panel1" when it is created in HTML its ID becomes "ctl00_pvt_main_Panel1". If I use that ID all is well.
Thanks for the help!!
Thanks for the help!!
I am using similar code trying to print contents of a panel. Basically within the panel I have an image that is 2550 X 3300 which is the size of a 8 X 11 sheet of paper. The only issue that I am having is that when it prints there is a blank 2nd page. Do you have any idea of how to fix this issue?
</head>
<script type = "text/javascript">
function PrintPanel() {
var panel = document.getElementById("< %=pnlConte nts.Client ID%>");
var printWindow = window.open('', '', 'height=400,width=800');
printWindow.document.write ('<html><h ead><title > </title>');
printWindow.document.write ('</head>< body >');
printWindow.document.write (panel.inn erHTML);
printWindow.document.write ('</body>< /html>');
setTimeout(function () {
printWindow.print();
}, 500);
return false;
}
</script>
</head>
<script type = "text/javascript">
function PrintPanel() {
var panel = document.getElementById("<
var printWindow = window.open('', '', 'height=400,width=800');
printWindow.document.write
printWindow.document.write
printWindow.document.write
printWindow.document.write
setTimeout(function () {
printWindow.print();
}, 500);
return false;
}
</script>
ASKER