Question

is there pageindex or pagecount for repeater? i able to do with gridview and could not find much with repeater and not in code-behind too, how would i do PageIndex and PageCount in Repeater?

 Page <%# rpt.PageIndex + 1 %> of <%# rpt.PageCount %>


<asp:Repeater ID="rpt" runat="server" OnItemCommand="rpt_OnItemCommand" OnItemDataBound="rpt_OnItemDataBound">
    <HeaderTemplate>
           <div >
                <div >
                     Page <%# rpt.PageIndex + 1 %> of <%# rpt.PageCount %>
                </div>
            </div>
     </HeaderTemplate>
     <ItemTemplate ......
</asp:Repeater>
Was it helpful?

Solution

Repeater control does not support paging out of the box, which means you have to implement it yourself. One way (and the easiest probably) is to use PagedDataSource object, which encapsulates paging-related properties and logic. There is a couple of examples in web on how to accomplish this: example one, example two, example three.

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