Link to home
Start Free TrialLog in
Avatar of M3mph15
M3mph15Flag for Australia

asked on

Using Page Breaks in a Repeater

Hi all,

I have a table inside a asp:Repeater which i display data from a database. (See attached Code). I have used a repeater because the query returns many results and I am wanting to create a Page Break after each table. At the moment i am using <hr size="1" style="PAGE-BREAK-AFTER: right; color: #FFFFFF;">.

Which does create the page breaks but the only problem is that it gets to the last record and still inserts a page break which prints a blank page.

Is there a bettwer way to set this up so it doesn't print the blank page.

Thanks in advanced
-M3mph15
<div style="text-align: center; font-family: Arial; font-size: medium;">
        <asp:Repeater ID="repParty" runat="server" DataSourceID="SqlDataSource1">
        <ItemTemplate>
        <asp:Table ID="Table1" runat="server" Width="80%" BackColor="Black" CellPadding="1" CellSpacing="1" GridLines="Both">
            <asp:TableRow ID="TableRow1" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Party Id</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "PARTY_ID")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow2" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Party Name</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "PARTY_NAME")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow3" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Category</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "CATEGORY")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow4" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Sub Category</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "SUB_CATEGORY")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow5" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Title</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "FUNCTION_TITLE")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow6" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Organisation Name</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "ORGANISATION_NAME")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow7" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Phone No 1</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "PHONE1_NUMBER")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow8" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Phone No 2</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "PHONE2_NUMBER")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow9" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Mobile no</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "MOBILE_NUMBER")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow10" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Fax No</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "FAX_NUMBER")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow11" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Email</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "EMAIL")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow26" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Best Way to Contact</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "BEST_WAY_TO_CONTACT")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow12" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Postal Address</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow13" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;Street</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "NUMBER_STREET_NAME")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow14" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;Suburb</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "SUBURB")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow15" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;Post Code</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "POST_CODE")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow16" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;State</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "PSTATE")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow17" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Residential Address</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow18" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;Street</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "RESIDENTIAL_NUMBER_STREET_NAME")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow19" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;Suburb</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "RESIDENTIAL_SUBURB")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow20" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;Post Code</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "RESIDENTIAL_POST_CODE")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow21" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">&nbsp;&nbsp;State</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "RSTATE")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow22" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Main Business Description</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "MAIN_BUSINESS_DESCRIPTION")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow23" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Party Description</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "PARTY_DESCRIPTION")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow24" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Comment</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "PARTY_COMMENT")%></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow25" runat="server" BackColor="White">
                <asp:TableCell HorizontalAlign="Left">Status</asp:TableCell>
                <asp:TableCell HorizontalAlign="Left">&nbsp;<%#DataBinder.Eval(Container.DataItem, "STATUS")%></asp:TableCell>
            </asp:TableRow>
            </asp:Table>
            <hr size="1" style="PAGE-BREAK-AFTER: right; color: #FFFFFF;">
        </ItemTemplate>
        </asp:Repeater>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:IAG Connection %>" 
            ProviderName="<%$ ConnectionStrings:IAG Connection.ProviderName %>" 
            SelectCommand="SELECT par.PARTY_ID, (SELECT cat.CATEGORY_NAME FROM IAG_PARTY_CATEGORIES cat WHERE cat.ID=par.PARTY_CATEGORY) as CATEGORY, 
(SELECT sub.SUB_CATEGORY_NAME FROM IAG_PARTY_SUB_CATEGORY sub WHERE sub.ID=par.PARTY_SUB_CATEGORY) as SUB_CATEGORY, par.PARTY_NAME, par.FUNCTION_TITLE, par.PARTY_DESCRIPTION, par.BEST_WAY_TO_CONTACT, par.ORGANISATION_NAME, par.PHONE1_NUMBER, par.PHONE2_NUMBER, par.MOBILE_NUMBER, par.FAX_NUMBER, par.EMAIL, par.NUMBER_STREET_NAME, par.SUBURB, par.POST_CODE, (SELECT crc.RV_MEANING FROM COM.CG_REF_CODES crc WHERE crc.RV_ACTIVE='Y' AND crc.RV_DOMAIN='IAG_STATE' AND crc.RV_LOW_VALUE=par.STATE) as PSTATE, par.RESIDENTIAL_DIFFERENT_POSTAL, par.RESIDENTIAL_NUMBER_STREET_NAME, par.RESIDENTIAL_SUBURB, par.RESIDENTIAL_POST_CODE, (SELECT crc.RV_MEANING FROM COM.CG_REF_CODES crc WHERE crc.RV_ACTIVE='Y' AND crc.RV_DOMAIN='IAG_STATE' AND crc.RV_LOW_VALUE=par.RESIDENTIAL_STATE) as RSTATE, par.MAIN_BUSINESS_DESCRIPTION, (SELECT crc.RV_MEANING FROM COM.CG_REF_CODES crc WHERE crc.RV_ACTIVE='Y' AND crc.RV_DOMAIN='IAG_PARTY_STATUS' AND crc.RV_LOW_VALUE=par.STATUS) STATUS, par.PARTY_COMMENT FROM IAG_PARTIES">
        </asp:SqlDataSource>
    </div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Juan_Barrera
Juan_Barrera
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of M3mph15

ASKER

Hi, Your solution worked perfectly thankyou!!!
No worries! Good luck!