Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print the whole asp.net webpage on a single button click event using VB?

Tags:

asp.net

vb.net

How to print the whole asp.net webpage on a single button click event using VB?

like image 607
user594849 Avatar asked Feb 08 '11 12:02

user594849


2 Answers

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();" />
like image 184
santosh singh Avatar answered Oct 31 '22 22:10

santosh singh


Why use VB for this? Printing is a client-side operation, just call window.print() in JavaScript. Here are some examples.

like image 26
David Avatar answered Oct 31 '22 22:10

David