protected void btnReset_Click(object sender, EventArgs e)
(
RecordsCount = GetRecordsCount("default");//默认信息总数
PagesCount = RecordsCount / PAGESIZE + OverPage();//默认的页总数
ViewState["PagesCount"] = RecordsCount / PAGESIZE - ModPage();//保存末页索引,比页总数小1
ViewState["PageIndex"] = 0;//保存页面初始索引从0开始
ViewState["JumpPages"] = PagesCount;
//保存页总数,跳页时判断用户输入数是否超出页码范围
//显示lbPageCount、lbRecordCount的状态
lbPageCount.Text = PagesCount.ToString();
lbRecordCount.Text = RecordsCount.ToString();
//判断跳页文本框失效
if (RecordsCount <= 10)
{
GotoPage.Enabled = false;
}
GridViewDataBind("default");//调用数据绑定函数TDataBind()进行数据绑定运算
}
这里的高效分页方法主要用的是select top 10 Id ,Name from tb where Id not in (select top 10*N from tb order by Id asc) order by Id asc