2

Here is the issue:

We have a report with many gridviews in an aspx page. However, when we print them, they don't page correctly, as one would expect.

I found a library that will create page breaks correctly within a single page break. But, yet again, it is not aware about other gridviews, so if the last gridview ended in the middle of the page, the first page for the next gridview will be broken.

How can we print these multiple gridviews with proper print paging?

The library that I found: http://www.codeproject.com/KB/custom-controls/GridViewPrinting.aspx

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
  • What is proper print paging? Do you want each grid to start on a new page? – JoshBerke May 01 '09 at 12:36
  • Can you describe how the next gridview is broken after a gridview ends in the middle of the page? After looking at the CodeProject page I can't figure out what the problem might be, it looks like it should work to me. – PhillFox May 01 '09 at 20:06

1 Answers1

1

If you want each GridView to print on a new page, you could wrap each GridView in a div and set the "page-break-after" css property to "always" for each div. So, it might look like:

<div style="page-break-after:always;">
    <asp:GridView ID="GridView1" runat="server">
    ...
    </asp:GridView>
</div>

Omit the "page-break-after" property on the last GridView so you don't print an extra page.

Austin
  • 4,638
  • 7
  • 41
  • 60