webconfig:
<system.web>
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
<controls>
<add tagPrefix="webdiyer" namespace="Wuqi.Webdiyer" assembly="AspNetPager" />
</controls>
</pages>
</system.web>
前台:
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
.pull-right {
float: right !important;
500px;
font-size: 16px;
margin-right: 20px;
600px;
margin-top: 15px;
position: static;
}
<div class="pull-right">
<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"
BackColor="#F8B500" AlwaysShow="true" ShowInputBox="Always" SubmitButtonText="跳转" SubmitButtonStyle="botton"
OnPageChanged="AspNetPager1_PageChanged">
</webdiyer:AspNetPager>
</div>
后台
PagedDataSource pds = new PagedDataSource();
pds.DataSource = dv;
pds.AllowPaging = true;
pds.PageSize = 5;
AspNetPager1.RecordCount = dv.Count;
AspNetPager1.PageSize = pds.PageSize;
rptView.DataSource = pds;
rptView.DataBind();
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;//索引同步
rptView.DataSource = pds;
rptView.DataBind();
}