gedDataSource pds = new PagedDataSource();
pds.AllowPaging = true;//设置数据绑定控件启用分页
pds.CurrentPageIndex = CurrentPageIndex;//使用状态保持保存当前页数
pds.DataSource = ItemService.GetItems();//指定数据源
pds.PageSize = this.PageSize;//设置每页记录数
this.PageCount = pds.PageCount;//总页数
this.lbl.text= 第 CurrentPageIndex 页,共 this.PageCount 页;
this.datalistItems.DataSource = pds;
this.datalistItems.DataBind();
}
********************
对比:SQL分页每次返回数量少,适合大数据量(百万行)的数据进行分页
PagedDataSource使用比较方便,但一次返回所有数据,一般适合不超过1万行的(与GridView自带分页相似)
本文来源:https://www.2haoxitong.net/k/doc/8511e2679b6648d7c1c746c1.html