后面页面
public partial class _default : system.web.ui.page
{
protected void page_load(object sender, eventargs e)
{
recordcount = page.retrievedatacount();
totalpages = (int)(math.ceiling((double)recordcount / (double)page.pagesize));
if (!ispostback)
{
binddata();
}
}
alex.pagetools page = new alex.pagetools("test", "*", "1=1", "user_account", false, "user_account", 10, 1, null);
int recordcount;
public int totalpages;
private void binddata()
{
int pageindex = smartgridview1.pageindex;
if(totalpages>0)
{
if(pageindex>totalpages-1)
{
pageindex=totalpages-1;
}
}
else
{
pageindex=0;
}
smartgridview1.pageindex=pageindex;
page.pageindex=pageindex+1;
smartgridview1.datasource = page.retrievepagerdata();
smartgridview1.databind();
if (this.smartgridview1.pageindex == 0)
{
this.btnfirst.enabled = false;
this.btnprev.enabled = false;
if (totalpages == 1)
{
this.btnlast.enabled = false;
this.btnnext.enabled = false;
}
}
else if (this.smartgridview1.pageindex == totalpages - 1)
{
this.btnlast.enabled = false;
this.btnnext.enabled = false;
}
首页 1 2 3 4 5 末页