public void BindAspNetPager() { this.AspNetPager1.RecordCount = Int32.Parse(sqlHelperWithParameter.GetScalar("select count(*) from [admin]").ToString()); int pageIndex = this.AspNetPager1.CurrentPageIndex - 1; int pageSize = this.AspNetPager1.PageSize = 10; Repeater1.DataSource = sqlHelperWithParameter.GetDataSet2(pageIndex, pageSize, "select * from [admin]"); Repeater1.DataBind(); }
protected void AspNetPager1_PageChanged(object sender, EventArgs e) { BindAspNetPager(); }
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" Width="100%" NumericButtonCount="6" UrlPaging="True" NumericButtonTextFormatString="[{0}]" CustomInfoHTML="第 <font color=‘red‘><b>%CurrentPageIndex%</b></font> 页 共 %PageCount% 页 显示 %StartRecordIndex%-%EndRecordIndex% 条" ShowCustomInfoSection="Left" FirstPageText="首页" LastPageText="末页" NextPageText="下页" PrevPageText="上页" Font-Names="Arial" AlwaysShow="true" ShowInputBox="Always" SubmitButtonText="跳转" SubmitButtonStyle="botton" OnPageChanged="AspNetPager1_PageChanged"> </webdiyer:AspNetPager>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>