Search code examples
asp.netpaginationrepeater

ASP.NET paging in div


<asp:Repeater id="repeater1" runat="server" DataSourceID="SqlDataSource1">
     <ItemTemplate>
         <div id ="news">
             <div style ="float:left;position:relative;margin-left:10px;margin-top:10px;"><asp:Image ID="lblImg"  runat="server"  src ='<%#Eval("ImageUrl") %>'></asp:Image></div>
             <%--<div style ="position:relative;">--%><asp:Label ID="lblContent" runat="server" Text='<%#Eval("Subject") %>'></asp:Label><%--</div>--%>
             <div style ="float:none;position:relative;"><asp:Label ID="lblTitle" runat="server" Text='<%#Eval("Description") %>'></asp:Label></div>

         </div>
    </ItemTemplate>    
</asp:Repeater>

How will I code paging on this site?

<div id="pager">
    <asp:DataPager ID="dpgSearchResultsPager" runat="server" PagedControlID="lvwSearchResults">
        <Fields>
            <asp:NextPreviousPagerField ShowNextPageButton="False" ButtonCssClass="previousNextLink" />
            <asp:NumericPagerField ButtonCount="10" ButtonType="Link" NumericButtonCssClass="numericLink" />
            <asp:NextPreviousPagerField ShowPreviousPageButton="False" ButtonCssClass="previousNextLink" />
        </Fields>
    </asp:DataPager>
</div>

This isnt working , and if anybody know write it. And instead of previous and next i want paging with numbers .


Solution

  • You can't do paging with the help of a pager to your repeater as this is used for listview paging rather than as a repeater.

    Have a look at this article that explain the steps to implement paging for repeater:

    Adding Paging Support to the Repeater or DataList with the PagedDataSource Class