日期:2014-05-17 浏览次数:20484 次
PagedDataSource pds = new PagedDataSource(); //创建分页对象
pds.DataSource = ds.Tables[0].DefaultView; //绑定分页数据
pds.AllowPaging = true; //开启分页
int pagerowsize = pagesize;//每页显示几行
int datarocount = this.ds.Tables[0].Rows.Count; // 数据集中共有多少行
int totalpage = pds.PageCount;//总页数
int pagedqindex = pds.CurrentPageIndex;//当前页索引
int pagepor = pagedqindex - 1;//上一页
int pageext = pagedqindex + 1;//下一页
int strat = 0;
if (Request.QueryString["page"] != null) //判断请求页面的参数是否为空,为空则表示当前还没分过页
{
pds.CurrentPageIndex = Convert.ToInt32(Request.QueryString["page"]) - 1;
//具体的数字分页逻辑??怎么写,类似google的那个
}
else
{
end = 10;
}
for (int i = strat+1; i <=end; i++)
{
this.kje_con_fylb.InnerHtml += "<span class=\"kje_con_fyin\"><a href=\"" + HttpContext.Current.Request.CurrentExecutionFilePath + "?page=" + i + "\">" + i + "</a> </span>";
}
kje_con_fylb.InnerHtml += "<span class=\"kje_con_fyin\">共" + totalpage + "页</span>";
this.DataList1.DataSource = pds;
this.DataList1.DataBind();