开发者

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

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜