Yasemin Boy Ertan
Yasemin Boy Ertan

Reputation: 85

print page in asp.net without master page's controls

I want to print my page accept the elements of masterpage. there is a user control in masterpage and it is important for me. also my print button is on master page. thanks..

Upvotes: 4

Views: 5818

Answers (2)

Zaheer Ahmed
Zaheer Ahmed

Reputation: 28528

You require to create new style sheet print.css and set CSS media=print

for example :

<style media="screen">
  .noPrint{ display: block; }
  .yesPrint{ display: block !important; }
</style>

<style media="print">
  .noPrint{ display: none; }
  .yesPrint{ display: block !important; }
</style>

and add class to "yesPrint" to the sections you want to print

  <asp:ContentPlaceHolder class="yesPrint" id="MainContent" runat="server">
  </asp:ContentPlaceHolder>

for more detatil : http://www.codeproject.com/KB/HTML/Printing_with_CSS.aspx

Upvotes: 3

MissCoder87
MissCoder87

Reputation: 2669

You can setup a Print Stylesheet that formats thing for printing / you can hide things you don't want printing.

You can read more about them http://www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml here

Upvotes: 1

Related Questions