So I have a repeater control that lists a bunch of information for each staff member...one after another. Problem is when I try to print this list I have staff records starting out in the middle of the page. I would like to solve this issue by forcing a page break at the beginning or end of each record/repeater item. How can I accomplish this?
If it's any help, this is the structure of the page:
<body>
<form>
<asp:repeater>
<itemtemplate>
<table>
<bunch of html>
</bunch of html>
</table>
</itemtemplate>
</asp:repeater>
</form>
</body>
To fix this just change it to page-break-after:auto. It will break correctly and not create an extra blank page.
page-break-before: auto instead of . page-break-before: always. The "auto" will break the page only if the contents are at the end if the page, this will prevent breaking the page and leaving a lot of blank space. Save this answer.
We can add a page break tag with style "page-break-after: always" at the point where we want to introduce the pagebreak in the html page.
Place the following code in the HEAD of the html:
<STYLE TYPE='text/css'>
P.pagebreakhere {page-break-before: always}
</STYLE>
Then place the following code in the BODY of the html where you want the pagebreak:
<P CLASS="pagebreakhere">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With