ASP.NET分頁組件 0.1.0

 

修改以前做的ASCX用戶組件,改編成真正意義的組件,用於製作ASP.NET中的DBGrid,DBList,Repeater等的自定義分頁,配合存儲過程,能提供高效的的分頁功能。

屬性:

Number:記錄總數;

PageSize:每頁顯示數量;

CurrentPage:當前頁碼(只讀)

事件:

翻頁時觸發PageChanged事件;

演示代碼:

 public class WebForm1 : System.Web.UI.Page
 {
  protected AspControls.PageUpDown PageUpDown2;
 
  private void Page_Load(object sender, System.EventArgs e)
  {
   if (!Page.IsPostBack)
   {
    PageUpDown2.Number = 300;
    PageUpDown2.PageSize = 30;
   }
  }

  private void PageUpDown1_PageChanged(object sender, System.EventArgs e)
  {
   Response.Write(PageUpDown2.CurrentPage);
  }

  override protected void OnInit(EventArgs e)
  {
   this.PageUpDown2.PageChanged += new AspControls.PageUpDown.PageEventHandler(this.PageUpDown1_PageChanged);
   this.Load += new System.EventHandler(this.Page_Load);
  }
 }

顯示效果:(CSS由頁面定義)

o_pageupdown.gif

下載

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章