Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I tried to apply the page break on a table row in grid view but the page break doesn't seem to work in chrome but works fine in Mozilla Firefox and IE .


I am trying to print a grid-view with Header on each pages but the page break is giving issue when printed via chrome
Posted

Refer article on similar question here[^]
 
Share this answer
 
C#
private void printGrid_Click(System.Object sender, System.EventArgs e)
{
   printDocument1.Print();
}
private void printDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
   PaintEventArgs myPaintArgs = new PaintEventArgs(e.Graphics, new Rectangle(new Point(0, 0), this.Size));
   this.InvokePaint(dataGrid1, myPaintArgs);
}



This example requires:

A Button control named printGrid with a Click event handler.
A DataGrid control named dataGrid1.
A PrintDocument component named printDocument1 with a PrintPage event handler.
 
Share this answer
 
Comments
Member 10329985 28-Nov-13 0:36am    
painteventargs is available for web forms ???or only for windows forms ??

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