前台
代码
<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();
}