AspNetPager绑定DataTable进行分页操作
DataTable dt = new DataTable();
dt = new NewsManager().SelectAll();
//声明DataSet数据集合
DataSet ds = new DataSet();
//把DataTable填充至DataSet
ds.Merge(dt);
//声明数据绑定类
PagedDataSource pds = new PagedDataSource();
//启用分页设置
pds.AllowPaging = true;
//单页显示条数(AspNetPager1.PageSize分页控件单页显示条数)
pds.PageSize = AspNetPager1.PageSize;
//当前页索引(AspNetPager1.CurrentPageIndex - 1分页控件当前页索引)
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
//绑定数据源
pds.DataSource = ds.Tables[0].DefaultView;
//数据Count
AspNetPager1.RecordCount = pds.DataSourceCount;
//Repeater绑定数据
this.repNews.DataSource = pds;
this.repNews.DataBind();