Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using ASP.NET framework.
After the user select the necessary option a table will appear with all records in a gridview.Please tell me how to enable the user to print this records in particular printing format on clicking a custom printing button.
I want that after clicking the print 'button' a new windows will appear that contain only the records table.
Updated 8-Mar-10 22:01pm

1 solution

One way to accomplish this would be through the usee of css styles such that you have one style sheet for the screen and one for the printer, like so:

<link href="CSS/Print.css" rel="stylesheet" type="text/css" media="print" />
<link href="CSS/Screen.css" rel="stylesheet" type="text/css" media="screen" />

The Print.css hides all of the elements that you don't want to print and, conversely, may expose previously hidden elements that you do want to print. Thus, when the page is printed only those items that should be printed will be.

Note that there ar ealso other ways to accomplish what you want but this should get you started.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900