How to print the whole asp.net webpage on a single button click event using VB?
No Server side code required.you can use javascript inbuilt function print().
<input type=button name=print value="Print" onclick="javascript:window.print()">
EDIT:
If you are using server control button then create a javascript function and call this function on OnClientClick event.
<script type="text/javascript">
function PrintPage() {
window.print();
}
</script>
<asp:Button ID="btnPrint" runat="server" Text="Print" OnClientClick="javascript:PrintPage();" />
Why use VB for this? Printing is a client-side operation, just call window.print()
in JavaScript. Here are some examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With