熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

AspNetPager分頁

2013-11-13 10:24:11  來源: .NET編程 

  前台

  代碼

  <webdiyer:AspNetPager ID=AspNetPager runat=server BackColor=#EEEEEE

  CenterCurrentPageButton=True

  CustomInfoHTML=共%PageCount%頁當前為第%CurrentPageIndex%頁每頁%PageSize%條

  FirstPageText=首頁 LastPageText=尾頁 NextPageText=下一頁

  onpagechanging=AspNetPager_PageChanging PageIndexBoxType=DropDownList

  PageSize= PrevPageText=上一頁 ShowCustomInfoSection=Left

  ShowPageIndexBox=Always SubmitButtonText=Go TextAfterPageIndexBox=

  TextBeforePageIndexBox=轉到>

  </webdiyer:AspNetPager>

  後台

  代碼

  protected void Page_Load(object sender EventArgs e)

  {

  if (!IsPostBack)

  {

  Bind();

  }

  }

  public void Bind()

  {

  user l = new user();

  List<user> m = lGetList();

  AspNetPagerRecordCount = mCount;

  PagedDataSource pds = new PagedDataSource();

  pdsAllowPaging = true;

  pdsPageSize = AspNetPagerPageSize;

  pdsCurrentPageIndex = AspNetPagerCurrentPageIndex ;

  pdsDataSource = m;

  grdY_userDataSource = pds;

  grdY_userDataBind();

  }

  protected void AspNetPager_PageChanging(object src WuqiWebdiyerPageChangingEventArgs e)

  {

  thisAspNetPagerCurrentPageIndex = eNewPageIndex;

  Bind();

  }


From:http://tw.wingwit.com/Article/program/net/201311/13512.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.