Ali M Alramil
Ali M Alramil

Reputation: 39

print in the master page

I found in many websites a print button in every page

I think this where you can put it in the master page

I have tried onclick="window.print" but it shows me error that window is not a part of something

could you please help me in doing this

"I Want a Print Button in Every Single Page In My Website "

Upvotes: 2

Views: 575

Answers (3)

शेखर
शेखर

Reputation: 17614

If you have master page in all of your pages then you can put a button on master page.
And write javascript function as follows

<button onclick="window.print()">Print</button>

Here is a link
http://www.dotnettwitter.com/2011/02/how-to-print-content-page-information.html
http://www.codeproject.com/Questions/387558/Javascript-Window-Print-not-working-in-Master-Page

Edit 1

<asp:ImageButton ID="MessageButton" runat="server" 
                 OnClientClick="window.print();return false;"  ImageUrl="Header.gif"/>

Upvotes: 1

Sagar Hirapara
Sagar Hirapara

Reputation: 1697

Put this in your Master Page

<button value="print" onclick="window.print()"></button>

Upvotes: 0

chrx
chrx

Reputation: 3572

Make sure you include parentheses:

<button onclick="window.print()">print</button>

Example: http://jsfiddle.net/aD8yf/

Upvotes: 1

Related Questions