There are many ways to page data in a DataList control or Repeater control in ASP.NET. But I think the following solution is the easiest way to create a custom paging when working with a DataList or a Repeater control. You can modify to have the "Next" and "Previous" button as well as styling the current page number easily. This article is from http://itmanagement.earthweb.com and I hope it will help you sometimes!
A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.
Here's the code behind for the page this tip builds:
using System; using System.Data; using System.Collections; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient;
