Page break in HTML / ASP when opening and printing multiple records

So, I have a repeater control that lists a bunch of information for each employee ... one by one. The problem is that when I try to print this list, I have regular posts starting from the middle of the page. I would like to solve this problem by causing a page break at the beginning or end of each record / repeat element. How to do it?

If that helps, this is the page structure:

<body> <form> <asp:repeater> <itemtemplate> <table> <bunch of html> </bunch of html> </table> </itemtemplate> </asp:repeater> </form> </body> 
+4
source share
3 answers

Put the following code in the HEAD html:

 <STYLE TYPE='text/css'> P.pagebreakhere {page-break-before: always} </STYLE> 

Then put the following code in the BODY html where you want to split the page:

 <P CLASS="pagebreakhere"> 
+11
source

You can use the CSS rules page-break-before and page-break-after .

See page breaks in the CSS 2.1 specification.

+5
source

See page-break-before and page-break-after css declarations

+2
source

Source: https://habr.com/ru/post/1336382/


All Articles