aurelio
aurelio

Reputation: 57

ASP.net ListView control

I am displaying the products catalog on my e-commerce site using ListView but how can I limit the amount of products that I want to show per page? Cheers!

Upvotes: 1

Views: 2147

Answers (2)

Devin Burke
Devin Burke

Reputation: 13820

This web page will tell you how to setup a DataPager on a ListView. The setting on the pager for controlling the number of rows per page is PageSize.

Here is a snippet of code to setup a DataPager. Note that PagedControlID should be the id of your list view control. The PageSize="50" specifies that fifty rows per page are displayed.

<asp:DataPager runat="server" ID="dpMyDatePager" PageSize="50"
 PagedControlID="lvMyListView">
    <Fields>
        <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True"
         ShowFirstPageButton="True" />
    </Fields>
</asp:DataPager>

Upvotes: 3

Jayantha Lal Sirisena
Jayantha Lal Sirisena

Reputation: 21376

you can put the page size by having this in layout template

 <asp:DataPager ID="dpListView" runat="server" PageSize="2">

Upvotes: 0

Related Questions