Question

Using the code below i am trying to page break after every two rows of my list view control when my apsx page is genrated to a PDF page...But some how its not working ..can someone please check what i am doing wrong here or suggest any other method to achieve it

<asp:ListView ID="ListView1" runat="server"  
    DataSourceID="DS_DvtImages" GroupItemCount="2">
        <ItemTemplate>

            <td id="Td1" runat="server"   class='<%# ((ListViewDataItem)Container).DisplayIndex % 2 == 0 ?  "page-break-before: always" : "" %>'    style="color: #333333; border-style:solid;"  >
                <asp:Image ID="Image1"   runat="server"   ImageUrl='<%# "~/ImageHandler.ashx?MaxHeight=500&MaxWidth=500&AttachmentId=" + Eval("ATTACHMENTID") %>' Height="300px" Width="300px" />
                &nbsp;<br />
                <span  style="width:300px; background-color:Gray">       
          <asp:Label ID="Label1" runat="server" Text='<%# Eval("ATT_name") %>' 
             Font-Size="10pt" ForeColor="Black" Width="100%" />
           </span>
                    </td>

        </ItemTemplate>
    <LayoutTemplate>
            <table id="Table1" runat="server"  class="ListViewMainTable">
                <tr id="Tr1" runat="server">
                    <td id="Td2" runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="1"  
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr id="Tr2" runat="server">
                </tr>
            </table>
      </LayoutTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
</asp:ListView>
Was it helpful?

Solution

page-break-before: always is the style, not the class. You will have to create a class with the style as page-break-before: always and then reference that class

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top