I have an asp.net web page created with web forms. It has a number of gridviews on it which are populated from a database on a button click.
I am looking to print a version of this page on a different button click. I’m looking to customize the printed page, with some text that is specified, then the gridview contents (user friendly version), then some more text etc
Any help is greatly appreciated
Marc
The simplest solution is to use
CSSto show and hide different elements depending on whether they are intended for screen or print. Include all elements in the page output (both print and screen) and useCSSto control them.Here’s a very simple example – let’s say you have a summary text that should only be included in the print version, and some buttons that should only be included in the screen version.
Markup:
CSS:
In the end any element marked with
CSSclassscreenOnlywill be hidden from print content, and any element marked withCSSclassprintOnlywill be hidden from the screen version.From there simply have a print button or link on the page somewhere with: