asp.net PagedDataSource分页实现代码
private void databind(ilist<loginlog> datasource,int count)
{
pageddatasource pds = new pageddatasource();
pds.datasource = datasource;
pds.allowpaging = true;
pds.pagesize = 10;
pds.currentpageindex = index;
viewstate["allpage"] = pds.pagecount;
if (index == 0)
{
this.imgpre.visible = false;
this.imgfrist.visible = false;
}
else if (index == pds.pagecount - 1)
{
this.imgnext.visible = false;
this.imgend.visible = false;
}
if (count == 0)
{
this.lblcount.text = "对不起,没有您要查询的记录;";
this.imgpre.visible = false;
this.imgfrist.visible = false;
this.imgnext.visible = false;
this.imgend.visible = false;
}
else if (count<=10)
{
this.lblcount.text = "共 " + count + " 条数据 当前 " + (pds.currentpageindex + 1) + "/" + pds.pagecount + " 页";
this.imgpre.visible = false;
this.imgfrist.visible = false;
this.imgnext.visible = false;
this.imgend.visible = false;
}
else
{
this.lblcount.text = "共 " + count + " 条数据 当前 " + (pds.currentpageindex + 1) + "/" + pds.pagecount + " 页";
}
this.gridview1.datasource = pds;
this.gridview1.databind();
}
补充:asp.net教程,C语言