Reputation: 57
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
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
Reputation: 21376
you can put the page size by having this in layout template
<asp:DataPager ID="dpListView" runat="server" PageSize="2">
Upvotes: 0