How can I do simple paging with DataList
. I don't want to go for CustomPaging
.
Is there any simple methods like we do Paging in GridView
.
I am willing to using DataPager
comtrol
Simplest way is probably to use the PagedDataSource
an example with Repeater is shown here: Adding Paging Support to the Repeater or DataList with the PagedDataSource Class
// Populate the repeater control with the Items DataSet
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = Items.Tables[0].DefaultView;
// Indicate that the data should be paged
objPds.AllowPaging = true;
// Set the number of items you wish to display per page
objPds.PageSize = 3;
// Set the PagedDataSource's current page
objPds.CurrentPageIndex = CurrentPage - 1;
repeaterItems.DataSource = objPds;
repeaterItems.DataBind();