protected void BindData(DataSet ds)
{
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables[0].DefaultView ;
objPds.AllowPaging = true;
objPds.PageSize = 10;
int curpage;
if (Request.QueryString["Page"] != null)
{
curpage = Convert.ToInt32(Request.QueryString["Page"]);
}
else
{
curpage = 1;
}
objPds.CurrentPageIndex = curpage - 1;
PageShow.Visible = true;
PreLink.Visible = true;
NextLink.Visible = true;
PageShow.Text = "当前页" + curpage .ToString();
if (!objPds.IsFirstPage)
{
PreLink.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(curpage - 1);
}
if (!objPds.IsLastPage)
{
NextLink.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(curpage +1);
}
DList.DataSource = objPds;
DList.DataBind();
}
学习datalist加分页
最新推荐文章于 2021-02-24 04:32:13 发布