Click here to Skip to main content
15,889,356 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all..

I have many gridviews with many column headers at each gridview.
Example one of my gridviews is:

MC | OP | QC  | DATE | 1/7 | 2/7 | 3/7 | 4/7 | 5/7 | 6/7 | .............. | 31/7 |
----------------------------------------------------------------------------------
102| A  | B   |      |  0  |  0  |  0  |  0  |  0  |  3  | .............. |  5   |


I want to print all data in the gridview into 1 A3 paper (Landscape). In aspx, I put the gridview inside a panel with scrollbars.
After removing the panel and scrollbars, the gridview width increases and after printing, not all the data will be printed. It only limits until A3 landscape size and cut the remaining content which is outside printing area.

My idea is to insert break if the gridview column is outside of the panel printing area.
How to do so?


MC | OP | QC  | DATE | 1/7 | 2/7 | 3/7 | 4/7 | 5/7 | 6/7 |  7/7 | 8/7 | 9/7 | 10/7|
-----------------------------------------------------------------------------------
102| A  | B   |      |  0  |  0  |  0  |  0  |  0  |  3  |   1  |  0  |  2  |  1  |

11/7 | 12/7 | 13/7 | 14/7| 15/7 | 16/7 | 17/7 | 18/7 | 19/7 | 20/7 |  21/7 | 22/7 |
-----------------------------------------------------------------------------------
  1  |  2   |  0   |  0  |  0   |  0   |  0   |  0   |  0   |  3   |   1   |  0   |


Thanks
Posted
Updated 21-Jul-13 19:16pm
v2
Comments
Dholakiya Ankit 22-Jul-13 1:27am    
what width you have given to gridview if you give 100% then it should automatically adjust but if you give fixed then your headers should be cutoff while printing.......
snamyna 22-Jul-13 2:13am    
if I set width 100%, and it automatically resize the gridview to fit the paper. But the gridview data sometimes cannot be read. Some of my gridviews have more column header. For example, for each date, I split the header into 6 time. (8am, 12 pm, 4 pm, 8 pm, 12 am,4 am).
So for a gridview with 31 days, it will become 31 x 6 = 186++ column headers.

1 solution

try these
http://www.aspsnippets.com/articles/print-functionality-in-asp.net-gridview-control.aspx
 
Share this answer
 
Comments
snamyna 22-Jul-13 1:17am    
I have tried the code before. But my gridview has many column headers. See my updated question for the sample of inserting break in gridview.
Member 11136674 1-Dec-14 21:36pm    
did you find already a solution? im having the same problem
snamyna 1-Apr-15 22:35pm    
Not yet..If you find the solution, hope for your kindness to share with me too.

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