Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force page break in HTML/ASP when opening and printing multiple records

Tags:

html

css

asp.net

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>
like image 376
Albert Avatar asked Jan 20 '11 21:01

Albert


People also ask

How do you deal with page breaks when printing large in HTML?

To fix this just change it to page-break-after:auto. It will break correctly and not create an extra blank page.

How do I make a page-break dynamic in HTML?

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.

How do you put a page-break in HTML?

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.


1 Answers

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">
like image 189
Cyberdrew Avatar answered Sep 21 '22 16:09

Cyberdrew