paging repeater RRS feed

  • Question

  • User855106052 posted

    hi guys

    how can I change my code to paging my repeater?

    	Sub BindServicos()
            Con = New OleDbConnection(StrCon)
            Cmd = New OleDbCommand("SELECT * FROM TabServicos", Con)
            Dtr = Cmd.ExecuteReader(CommandBehavior.CloseConnection)
            RptTabelaServicos.DataSource = Dtr
    	End Sub
    <table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF" class="TextoNormalEscuro" style="margin-bottom:5px;" id="tbluserdata">  
    <asp:Repeater ID="RptTabelaServicos" runat="server">
            <tr onClick="IrParaURL('<%# Container.DataItem("ServicoCod") %>')" onMouseOver="this.className='highlight2'" onMouseOut="this.className='normal'">
                <td><asp:Label ID="LblServicoCodLinha" Text='<%# Container.DataItem("ServicoCod") %>' runat="server" Visible="TRUE"></asp:Label</td>
                <td><%#DataBinder.Eval(Container.DataItem, "ServicoData","{0:d}")%></td>
                <td><%# Container.DataItem("ServicoDestino") %></td>bsp;</td>
                	<asp:Label ID="LblTotalDeRegistos" Text='<%# RptTabelaServicos.Items.Count %>' runat="server" Visible="FALSE" ></asp:Label>

    Monday, November 5, 2018 11:09 PM

All replies

  • User61956409 posted

    Hi indesk,

    Normally we can pass the PageIndex, PageSize as parameters of SQL query so that we can fetch the records for the desired page index.

    This article explained how to implement paging in Repeater control, you can refer to it and write your paging algorithm.

    With Regards,

    Fei Han

    Tuesday, November 6, 2018 6:17 AM