AspNetPage分页(repeater)

 

当然首先你要把bin文件放进你的项目,并加到你的工具栏去

 1  // 页头需引用的
 2  <% @ Register Assembly = " AspNetPager "  Namespace = " Wuqi.Webdiyer "  TagPrefix = " webdiyer "   %>
 3 
 4  控件部分(格式已经设计好)
 5  < webdiyer:AspNetPager ID = " AspNetPager1 "  runat = " server "  AlwaysShow = " True "  FirstPageText = " <font face='Webdings'>9</font> "
 6                                                                              LastPageText = " <font face='Webdings'>:</font> "  NextPageText = " <font face='Webdings'>8</font> "
 7                                                                              PrevPageText = " <font face='Webdings'>7</font> "  ShowCustomInfoSection = " Left "  InputBoxStyle = " width:19px "
 8                                                                              TextAfterInputBox = " "  TextBeforeInputBox = " 转到第 "  CustomInfoHTML = " 共检索到<strong>%RecordCount%</strong>条记录 页次:<strong>%CurrentPageIndex%/%PageCount%</strong> 每页<strong>%PageSize%</strong>条 "
 9                                                                              HorizontalAlign = " Right "  Width = " 100% "  ShowInputBox = " Always "  OnPageChanged = " AspNetPager1_PageChanged "
10                                                                              PageSize = " 20 "  ShowBoxThreshold = " 1 " >
11                                                                           </ webdiyer:AspNetPager >
12 

 

后台绑定的代码

 1  void  databind()
 2          {
 3               int  QYId  =  Convert.ToInt32(Request.Cookies[ " CompenyUser " ].Value); // 企业的Id
 4              DataTable dt  =  bll.Viewlist(QYId);
 5               this .AspNetPager1.RecordCount  =  dt.Rows.Count; // 获取数据的总数
 6 
 7              PagedDataSource pds  =   new  PagedDataSource();
 8              pds.DataSource  =  dt.DefaultView; // 为控件绑定数据
 9              pds.AllowPaging  =   true ; // 分页启用
10              pds.PageSize  =  AspNetPager1.PageSize; // 获取每页显示的数量
11              pds.CurrentPageIndex  =  AspNetPager1.CurrentPageIndex  -   1 ;
12 
13              Repeater1.DataSource  =  pds;
14              Repeater1.DataBind();
15          }
16 

分页,只需要把绑定放在AspNetPager1_PageChanged 事件里

转载于:https://www.cnblogs.com/UouHt/archive/2009/05/31/1492662.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值