ShowPageIndexBox="Always" PageIndexBoxType="DropDownList" TextBeforePageIndexBox="转到: "
FirstPageText="首页" LastPageText="末页" PrevPageText="上一页" NextPageText="下一页" HorizontalAlign="left"
EnableTheming="true" OnPageChanged="AspNetPager1_PageChanged">
</webdiyer:AspNetPager>
后端代码
DataTable dt = BulletionAction.ReturnTable(this.UserCode, strwhere);
AspNetPager1.RecordCount = dt.Rows.Count;
if(dt.Rows.Count>0){
PagedDataSource pds = new PagedDataSource();
AspNetPager1.RecordCount = dt.Rows.Count;
pds.AllowPaging = true;
pds.PageSize = AspNetPager1.PageSize;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.DataSource = dt.DefaultView;
this.GridView1.DataSource = pds;
this.GridView1.DataBind();
}
}