From everything I\'ve read, it seemed that adding paging to a ListView control should be dead simple, but it\'s not working for me. After adding the ListView and DataPager contr
Take a look at the ListViewPagedDataSource.
private ListViewPagedDataSource GetProductsAsPagedDataSource(DataView dv)
{
// Limit the results through a PagedDataSource
ListViewPagedDataSource pagedData = new ListViewPagedDataSource();
pagedData.DataSource = dv;
pagedData.MaximumRows = dv.Table.Rows.Count;
pagedData.TotalRowCount = dpTop.PageSize;
if (Request.QueryString[dpTop.QueryStringField] != null)
pagedData.StartRowIndex = (Convert.ToInt32(Request.QueryString[dpTop.QueryStringField]) - 1) * dpTop.PageSize;
else
pagedData.StartRowIndex = 0;
return pagedData;
}
Though, I have a problem viewing the last page. The DataPager jumps back to the first page, but the data displayed is the last page.