[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 466
  • Last Modified:

Can you use a page-break in a DIV

Hi,
I first generated a seperate asp print page that was passed querysting values and looped through a recordest building at table, I used a modulator to count out 66 rows and on the 67 I build a new header and inserted a page-break in the table row. The page was the set to print on page load. All this worked fine, the document printed and the line breaks worked a treat.

However I wasn't happy with the open window look and feel so I decided to build the table within the ASP page that the original link was in, this meant showing the 'viewable version' and hiding the 'printable version' in a hidden DIV tag and use @media print to print out the page.

Again this approach worked fine except that the page-break stopped working??

Is it not possible to use a page-break within a DIV tag?
0
trojan_uk
Asked:
trojan_uk
  • 4
  • 3
1 Solution
 
thenoneCommented:
<DIV style="page-break-after:always"></DIV>
0
 
trojan_ukAuthor Commented:

That's how I have it at the moment but it doesn't work, originally I had <tr style="page-break-after:always">.

Like I said it seemed to work fine until I put the whole table into a DIV then it seemed to stop working
0
 
thenoneCommented:
post the div
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
trojan_ukAuthor Commented:
This is what I have in the head

<style media="print">
.Display {
        visibility:hidden;
        position:absolute;
             }
.Print {
        visibility:visible;
        position:absolute;
         }
</style>
<style media="screen">
.Print {
        visibility:hidden;
        position:absolute;         
         }
.Display {
        visibility:visible;
        position:absolute;
             }
</style>



then I add the div in the table build:

      If iColumnSpan Mod 66 = 65 Then 'if more then 66 lines insert new header and page break for print
ROWP = ROWP & "<div style=""page-break-after:always"">"            
ROWP = ROWP & "<tr>"
ROWP = ROWP & "<td colspan=""13"" align=""center""><strong>" & request("company") & " " & tREPORT &"</strong></td>"
ROWP = ROWP & "</tr>"
ROWP = ROWP & "<tr>"
ROWP = ROWP & "<td colspan=""13"" align=""center""><strong>" & DMONTH & "</strong></td>"
ROWP = ROWP & "</tr>"
ROWP = ROWP & "<tr>"
ROWP = ROWP & "<td width=""100"" align=""center""><strong>Number</strong></td>"
ROWP = ROWP & "<td width=""100"" align=""center""><strong>Call date</strong></td>"
ROWP = ROWP & "<td width=""100"" align=""center""><strong>Call time</strong></td>"
ROWP = ROWP & "<td align=""center""><strong>Duration (hh:mm:ss)</strong></td>"
ROWP = ROWP & "<td width=""100"" align=""center""><strong>Charge (&pound;)</strong></td>"
ROWP = ROWP & "<td width=""100"" align=""center""><strong>Dest Number</strong></td>"
ROWP = ROWP & "<td width=""114"" align=""center""><strong>Call type</strong></td>"
ROWP = ROWP & "</tr>"
ROWP = ROWP & "</div>"            
      end if      

and this is how it looks when I view the page source:

<div style="page-break-after:always">
<tr>
<td colspan="13" align="center"><strong>  - Expensive Call Report</strong></td>
</tr>
<tr>
<td colspan="13" align="center"><strong>July</strong></td>
</tr>
<tr>
<td width="100" align="center"><strong>Number</strong></td>
<td width="100" align="center"><strong>Call date</strong></td>
<td width="100" align="center"><strong>Call time</strong></td>
<td align="center"><strong>Duration (hh:mm:ss)</strong></td>
<td width="100" align="center"><strong>Charge (&pound;)</strong></td>
<td width="100" align="center"><strong>Dest Number</strong></td>
<td width="114" align="center"><strong>Call type</strong></td>
</tr>
</div>
0
 
thenoneCommented:
shouldn't you should be using response.write on the server side? Also call theis in the head with a name to refer and call in it in the body

"<div style=""page-break-after:always"">"            
0
 
trojan_ukAuthor Commented:
I think the problem was that I wasn't closing the DIV after each row, so I rebuild the code enclosing each set of results into a table and enclosing the whole table in a set of DIV's.

That seemed to cure the page break problem but then I was faced with another one in the form of the first page of print started halfway down the page?
0
 
trojan_ukAuthor Commented:
It's ok I have sorted it know, just need some Anadin to get rid of the headache.

Thanks for taking the time to help, and for this I will award you the points
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now