saifor.net
saifor.net

Reputation: 1

ListView pagination for images

I have made a Picasa type application using asp.net that uses the ListView control to display images in the browser.

All the images are appearing perfectly fine. It takes images directly from a server folder and instantly display in thumbnails. When any of the image is being clicked it uses jQuery to display that particular image in big size. Then it can be closed.

However, there is a problem. if there are more than 100 images in a single server folder, it skips few images and displays blank x there. So I decided to paginate 40 images per page. How can I do that in ListView?

Upvotes: 0

Views: 782

Answers (2)

Yannick Blondeau
Yannick Blondeau

Reputation: 9651

You will have to use a DataPager control inside the LayoutTemplate property of your ListView.

You can add it like this:

<asp:DataPager runat="server" ID="DataPager" PageSize="40">
    <Fields>
      <asp:NumericPagerField ButtonCount="10"
           PreviousPageText="<--"
           NextPageText="-->" />
    </Fields>
</asp:DataPager>

Upvotes: 1

Chris Gessler
Chris Gessler

Reputation: 23123

Here's an article that uses a DataPager control (with downloadable demo/source) - https://web.archive.org/web/20210125144848/http://www.4guysfromrolla.com/articles/021308-1.aspx#postadlink

Upvotes: 0

Related Questions