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);
this.HypUP_pages.Visible=false;
if(!objpds.IsLastPage)
this.HypDown_pages.NavigateUrl=Request.CurrentExecutionFilePath+"?Page="+Convert.ToString(curentpage+1);
this.HypDown_pages.Visible=false;
returnobjpds;
}
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;
}