/// <summary> /// Ìî³äÊý¾Ý /// </summary> protected override void FillPageNum() { long curPage = dataSource.CurrentPage + 1; long totlePage = dataSource.TotlePage; this.Visible = true; if (dataSource.TotleRecords == 0) { this.Visible = false; return; } TotlePage = totlePage; CurrentPage = dataSource.CurrentPage; lblPage.Text = TotlePage.ToString(); lblCP.InnerText = dataSource.TotleRecords.ToString(); txtPage.Value = curPage.ToString(); //btnLast.Enabled = true; //btnNext.Enabled = true; //btnFirsh.Enabled = true; //btnUp.Enabled = true; //if (dataSource.CurrentPage == 0) //{ // //lbPri.Enabled = false; // btnFirsh.Enabled = false; // btnUp.Enabled = false; //} //if (dataSource.CurrentPage >= TotlePage - 1) //{ // //lbNext.Enabled = false; // btnLast.Enabled = false; // btnNext.Enabled = false; //} PagerUrlCreater url = new PagerUrlCreater(); if (dataSource.CurrentPage != 0) { url[RequestPageNumName] = "1"; btnFirsh.NavigateUrl = url.GetUrl(); url[RequestPageNumName] = CurrentPage.ToString(); btnUp.NavigateUrl = url.GetUrl(); } if (dataSource.CurrentPage < TotlePage - 1) { url[RequestPageNumName] = TotlePage.ToString(); btnLast.NavigateUrl = url.GetUrl(); url[RequestPageNumName] = (CurrentPage + 2).ToString(); btnNext.NavigateUrl = url.GetUrl(); } }
/// <summary> /// 对控件进行翻页处理 /// </summary> /// <param name="sender"></param> /// <param name="currentIndex"></param> protected void DoPageIndexChange(object sender, long currentIndex) { if (pagerType == PagerType.RequestUrl) { PagerUrlCreater url = new PagerUrlCreater(); url[RequestPageNumName] = (currentIndex + 1).ToString(); Response.Redirect(url.GetUrl()); return; } ((PagerBase)sender).CurrentPage = currentIndex; if (OnPageIndexChange != null) { OnPageIndexChange(sender, currentIndex); } }
/// <summary> /// 重定向到指定页 /// </summary> /// <param name="url">url参数</param> public void Redirect(PagerUrlCreater url) { url[RequestPageNumName] = (CurrentPage + 1).ToString(); Response.Redirect(url.GetUrl()); }