ASP中七种实现分页显示的方法?
privatePagedDataSourceBindInfo(DataSetdsinfo)
{
//这里开始写分页代码
PagedDataSourceobjpds=newPagedDataSource();
//填充数据信息
objpds.DataSource=dsinfo.DefaultViewManager;
//是否在这里面起用分页
objpds.AllowPaging=true;
//设置3行分页
objpds.PageSize=3;
//计数行数
intcurentpage=0;
if(Request.QueryString["Page"]!=null)
curentpage=Convert.ToInt32(Request.QueryString["Page"]);
else
curentpage=1;
objpds.CurrentPageIndex=curentpage-1;
this.lblPagesInfo.Text=">>分页:当前页:"+Convert.ToString(curentpage)+",共有"+Convert.ToString(objpds.PageCount)+"页,每页显示"+Convert.ToString(objpds.PageSize)+"条";
if(!objpds.IsFirstPage)
this.HypUP_pages.NavigateUrl=Request.CurrentExecutionFilePath+"?Page="+Convert.ToString(curentpage-1);
else
this.HypUP_pages.Visible=false;
if(!objpds.IsLastPage)
this.HypDown_pages.NavigateUrl=Request.CurrentExecutionFilePath+"?Page="+Convert.ToString(curentpage+1);
else
this.HypDown_pages.Visible=false;
returnobjpds;
}
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有