subject: Repeater Paging in ASP.Net [print this page] Repeater Paging in ASP.Net Repeater Paging in ASP.Net
Most people use repeater in web projects and paging is always trouble for us. You never create paging which is in your minds. I was using collectionpager but there is to many numbers in my page for paging. like: 1-2-3-4-5-6-7-8-..... goes on. And collectionpager is not good enough. So I tried listview and datapager but it was not work correctly. In this example we make our paging style like wordpress classic paging method. (Older-Newer Posts)
Repeater and datalistcontrols offer a quick and flexibl datagridof displaying data on a ASPX page. But they offer nopaging functionality built in. The datagrid.control has in-builtpaging but its structure is more rigid. There are several articles on variousASP.NET Resource Sites that offer solutions, but I'm going to show you how to use the pagedatasourceclass.
The page uses one Repeater for the page numbers and a second one for the items. This example shows items from a product catalog, but any database table will do. To start, create a ViewState property (see the previous tip) to store the current page number. This property also is coded to return a zero, which is the first page number (at least as far as the database is concerned).When the page is first loaded, the code calls the LoadData routine, which gets a DataTable containing the records. Then, that is connected to the PagedDataSource class by way of a DataView object. The DataView also can provide sorting; this makes it easy to allow users to sort by a particular column heading. You simply create another ViewState property and store the sort field at this point.
You can find source codes and examples in this link.