列表采用SQLServer2005里面的分页方法
SetPaginationModel()
{
PaginationModel paginationModel = new PaginationModel();
paginationModel.TableName = "...";
paginationModel.GetFiledsName = "...";
paginationModel.OrderType = SysEnumClass.OrderBy.Desc;
paginationModel.OrderFiledName = "SortField";
paginationModel.PageIndex = 1;
paginationModel.PageSize = 10;
paginationModel.WhereString = "...";
paginationModel.TableName = "...";
paginationModel.GetFiledsName = "...";
paginationModel.OrderType = SysEnumClass.OrderBy.Desc;
paginationModel.OrderFiledName = "SortField";
paginationModel.PageIndex = 1;
paginationModel.PageSize = 10;
paginationModel.WhereString = "...";
this._PaginationModel = paginationModel;
}
PaginationModel是定义好的 对象,它是用来分页的对象。分页同时用到了AspNetPager控件。
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
this._PaginationModel.PageIndex = AspNetPager1.CurrentPageIndex;
BindData()
}
{
this._PaginationModel.PageIndex = AspNetPager1.CurrentPageIndex;
BindData()
}
BindData()中方法调用SQLServer2005中的分页存储过程(网上能找到这个)。如果分页进行排序,排序只有一个字段且有多个NULL,会导致分页失效(有的数据在不同的页中反复出现,而有的数据根本不出现)。故分页最好选择不会出现NULL值的字段来进行排序,或者用多个字段同时进行排序(多个字段排序耗费时间,可能有性能上的损失)