page break [Answered]RSS

15 replies

Last post Dec 09, 2009 04:02 AM by satyajitd

  • page break

    Dec 02, 2009 04:00 AM|satyajitd|LINK

    i have a simple asp page .populating with roll no and name within a table of 2 column

    i have almost 500 record...

    i want to print  10 record per page...

    please help... 

  • Re: page break

    Dec 02, 2009 10:07 AM|tomkmvp|LINK

    Page breaks are handled by CSS as a client matter. 

    Modify your ASP code to include a counter in the section that loops through the records.  After every ten records, insert some html/style code that indicates a page break.

    http://www.bing.com/search?q=css+page-break&mkt=*&FORM=IE8SRC&adlt=strict

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: page break

    Dec 03, 2009 12:20 AM|satyajitd|LINK

    thanks for quick reply...

    but can you provide a working code...as i have tried all this but i failed...

    take this example to work out...

    <table>

    <tr>

    <td>

    roll no

    </td>

    <td>

    name

    </td>

    </tr>

    <tr>

    <td>

    1

    </td>

    <td>

    a

    </td>

    </tr>

    ---

    ---

    ---

    ---

    ---

    <tr>

    <td>

    20

    </td>

    <td>

    t

    </td>

    </tr>

    </table>

    this is a dyhamic page containg roll no and name... i want only 10 records per page while printing...

    please help...

     

  • Re: page break

    Dec 03, 2009 10:17 AM|tomkmvp|LINK

    That's just the output HTML - we need to modify the underlying ASP code ...

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: page break

    Dec 04, 2009 02:24 AM|satyajitd|LINK

    can you please give me a working code

  • Re: page break

    Dec 04, 2009 07:42 AM|tomkmvp|LINK

     Sure - post your existing ASP code and I'll be happy to show you where you need to modify it.

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: page break

    Dec 04, 2009 09:28 AM|satyajitd|LINK

    dim studentlist std=”select rollno,name from table2” studentlist1=rsstudentarr.getrows() %>

    Sl. No. Roll name
    No Record Found

  • Re: page break

    Dec 04, 2009 09:35 AM|satyajitd|LINK

    dim studentlist

    std=”select  rollno,name from table2”

    studentlist1=rsstudentarr.getrows()

     

    <TABLE border="1" width="100%" align="center" bordercolor="black" style="border-collapse:collapse;">

                    <tr>

                                    <td>

                                                    <table align="center" width="100%">

                                                                    <tr>

                                                                                    <td style="text-align: center" colspan="3" style="font-family:Arial;font-size:large;font-weight:bold;">

                                                                                    <img alt="" height="84" src="\images\1.jpg" width="768px" />

     

                                                                                    </td>

                                                                    </tr>

                                                                    <tr >

                                                                                    <td style="text-align: center" colspan="3" style="border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000" style="font-family:Arial;

                                                                                    font-size:18;font-weight:bold;">

                                                                                   

                                                                                    </td>

                                                                    </tr>

                                                                    <tr >

                                                                                    <td align="center" colspan="3" style="font-family:Arial;font-size:18;font-weight:bold;" style="border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color:                                #000000">

                                                    </td>

                                                                    </tr>

                                                                    <tr height="27">

                                                                                    <td>

     

                                                                                    </td>

                                                                    </tr>

                                                                    <tr>

                                                                   

                                                                    <% if slist=1 and stdlist=1 then %>

                                                                                    <td align=left>

                                                                                                    <table border="1" width="100%" >

                                                                                                                    <tr >

                                                                                                                    <td width="4%">Sl. No.</td>

                                    <td width="9%">

                                                                                                                                    Roll

                                                                                                                                    </td>

     

                                                                                                                                   

                                                                                                                                    <td align="center">

                                                                                                                                    name   

                                                                                                                                    </td>

                                                                                                                                                   

                                                                                                                    </tr>

                                                                                                                    <% '---------------------------Print roll no and name--------------------------------------- %>

                                                                                                                    <% for i=0 to ubound(studentlist1,2)

                                                                                                                   

                                                                                                                     %>

                                                                                                                   

                                                                                                                    <tr>

                                                                                                                    <td>

                                                                                                                    <% =i+1 %>

                                                                                                                   

                                                                                                                    </td>

                                                                                                                    <td>

                                                                                                                   

                                                                                                                   

                                                                                                                   

                                                                                                                   

                                                                                                                                                    <% =studentlist1(1,i) %>

                                                                                                                                   

                                                                                                                    </td>

                                                                                                                   

                                                                                                                                    <td align="center">

                                                                                                                                                                                                                                                                                    <%=studentlist1(2,i)%>

                                                                                                                                    </td>

                                                                                                   

                                                                                                   

                                                                                                   

                                                                                                   

                                                                                                                                                                                                   

                                                                                                   

                                                                                                   

                                                                                                   

                                                                                                    </tr>

                                                                                    <% next %>

                                                                                                    </table>

                                                                                    </td>

                                                                                    <% else %>

                                                                                    <td align="center">

                                                                                    <font color ="red">No Record Found</font>

                                                                                    </td>

                                                                                    <% end if %>

                                                                    </tr>

                                                    </table>

                                    </td>

                    </tr>

    </table>

                                                                                                   

        

     

  • Re: page break

    Dec 04, 2009 01:44 PM|tomkmvp|LINK

    <%
    counter = 1
    for i=0 to ubound(studentlist1,2)
        if counter > 10 then
            pagestyle = "page-break-before:always;"
            counter = 1
        else
            pagestyle = ""
            counter = counter + 1
        end if
    %>
    <tr style="<%= pagestyle %>">
        <td>
            <% =i+1 %>
        </td>
        <td>
            <%=studentlist1(1,i) %>
        </td>
        <td align="center">
            <%=studentlist1(2,i)%>
        </td>
    </tr>
    <% next %>

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: page break

    Dec 06, 2009 10:51 PM|satyajitd|LINK

    thanks for the reply...

    but i am getting the roll no and name in the second page and the company logo in first page...

    again i want to repeat the header that is the title of the report and "NAME","ROLL NO"

    how to achieve that???

  • Re: page break

    Dec 07, 2009 09:56 AM|tomkmvp|LINK

    Modify the code I showed you to move the table start and end tags within the logic so the page break occurs either at the table start or end tag.

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: page break

    Dec 07, 2009 11:56 PM|satyajitd|LINK

    thanks...it works...but there is another problem

    i have the company logo that should appear in each page...

    if i manipulate the code you have provided... it is coming after printing no doubt...but in plain html viewing the logo is repeated...i want the repeatation only in printing not while just viewing...

  • Re: page break

    Dec 08, 2009 10:38 AM|tomkmvp|LINK

    Use @media in CSS to set what media the style applies to.

    http://www.w3schools.com/CSS/css_mediatypes.asp

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: page break

    Dec 09, 2009 04:01 AM|satyajitd|LINK

    thanks for your patience reply...it is working now...
  • Re: page break

    Dec 09, 2009 04:02 AM|satyajitd|LINK

    thanks for your patience reply...it is working now...

  • Re: page break

    Dec 09, 2009 04:02 AM|satyajitd|LINK

    thanks for your patience reply...it is working now...