all posts

Adding paging to a Repeater

Published to Blog on 20 Mar 2007

I've added paging to a Repeater a couple of time, though rather infrequently. Every time I take up the task again I either have to dig through old code or search Google once again. This time around I went straight to Google and found a nice simple implementation in an article on 4GuysFromRolla by Harrison Enholm, Adding Paging Support to the Repeater or DataList with the PagedDataSource Class. I have used this approach before, but wanted to list it here for future reference so I could find it easier.

Rather than go into details I'll defer to the article as he covers everything well enough. I will say that I did divert from the article's implementation in one small detail. The author chose to store his CurrentPage property (for maintaing his current page index across postbacks) in the ViewState. I try to keep ViewState turned off whenever I can so I chose to use a HiddenField instead.


Dan Hounshell
Web geek, nerd, amateur maker. Likes: apis, node, mobile, motorcycles, watches, food, Nashville, Savannah, Cincinnati and family. Dislikes: mean people
Dan Hounshell on Twitter


  • On 21 Mar 2007 Willy said:

    Thanks for the tip.