Most of the time you may come accross a simple implementation like printing a web page. But here I will not discuss about how to print a web page, instead I will discuss on how to not print specific elements on the page with the help of a CSS hack.
For example we have a web page which displays some content and a print button to print the web page if required. But we don’t want to print the print button on the page. There are various way to avoid this, what follows is one of the solution using CSS.
<head runat="server"> <style type="text/css" media="print"> .Non-PrintableControl { display:none; } </style> <script type="text/javascript"> function PrintWebPage() { window.print(); } </script> </head> <body> <form id="form1" runat="server"> <table> <tr> <td align="right"><input type="button" value="Print" onclick="PrintWebPage()" /></td> </tr> <tr> <td>This is printable content.</td> </tr> </table> </form> </body>