Implement Paging in ASP.Net ListView control without using DataPager in C# and VB.Net

Last Reply 3 months ago By pandeyism

Posted 3 months ago

hello,

i had sucessfully build the auto page number on the report for about 300 pages.

when a record had more than one full page, then the data need to jump to the next page, but then the number can't add the next number.

for example:  the main page number "3", then the second continue page should be number "4", but NO, it's blank. 

no number.  the number "4" will be the new record on the new page. 

can you tell me what i need to provide to you to see.  i build the auto page number in the Stored Procedure. 

i don't want to use the datapager.

thanks. 

<asp:ListView ID="ListView2" runat="server" DataSourceID="SqlDataSource1">
    <AlternatingItemTemplate>
        <tr style="background-color: #FFF8DC;">
            <td>
                <asp:Label ID="OrgCodeLabel" runat="server" Text='<%# Eval("OrgCode") %>' Font-Size="Small" />
            </td>
            <td>
                <asp:Label ID="OPTitleLabel" runat="server" Text='<%# Eval("OPTitle") %>' Font-Size="Small" />
            </td>
            <td>
                <asp:Label ID="Label2" runat="server" Text='<%# Eval("Number")%>' Font-Size="Small" />
            </td>
        </tr>
    </AlternatingItemTemplate>
    <ItemTemplate>
        <tr style="background-color: #DCDCDC; color: #000000;">
            <td>
                <asp:Label ID="OrgCodeLabel" runat="server" Text='<%# Eval("OrgCode") %>' Font-Size="Small" />
            </td>
            <td>
                <asp:Label ID="OPTitleLabel" runat="server" Text='<%# Eval("OPTitle") %>' Font-Size="Small" />
            </td>
            <td>
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("number")%>' Font-Size="Small" />
            </td>
        </tr>
    </ItemTemplate>
    <LayoutTemplate>
        <table id="Table1" runat="server">
            <tr id="Tr1" runat="server">
                <td id="Td1" runat="server">
                    <table id="itemPlaceholderContainer" 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; font-size: small">
                        <tr id="Tr2" runat="server" style="background-color: #DCDCDC; color: #000000;">
                            <th id="Th1" runat="server">
                                Agency
                            </th>
                            <th id="Th2" runat="server">
                                Program
                            </th>
                            <th id="Th3" runat="server">
                                Page Number
                            </th>
                        </tr>
                        <tr id="itemPlaceholder" runat="server">
                        </tr>
                    </table>
                </td>
            </tr>
            <tr id="Tr3" runat="server">
                <td id="Td2" runat="server" style="text-align: center; background-color: #CCCCCC;
                    font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000;">
                </td>
            </tr>
        </table>
        <p style="page-break-before: always;">
            &nbsp;</p>
    </LayoutTemplate>
</asp:ListView>

 

This question does not have replies that have been liked.