I've got a search results page that basically consists of a repeater with content in it. What I need is a way to paginate the results. Getting paginated results isn't the problem, what I'm after is a web control that will display a list of the available paged data, preferably by providing the number of results and a page size
+7
A:
Repeaters don't do this by default.
However, GridViews do.
Personally, I hate GridViews, so I wrote a Paging/Sorting Repeater control.
Basic Steps:
- Subclass the Repeater Control
- Add a private PagedDataSource to it
- Add a public PageSize property
- Override Control.DataBind
- Store the Control.DataSource in the PagedDataSource.
- Bind the Control.DataSource to PagedDataSource
- Override Control.Render
- Call Base.Render()
- Render your paging links.
For a walkthrough, you could try this link:
FlySwat
2008-09-10 00:42:34
is rolling your own paginated repeater worth not using a gridview?
Neil N
2009-05-28 17:59:21