关于网友提出的“ aspnetpager的问题”问题疑问,本网通过在网上对“ aspnetpager的问题”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: aspnetpager的问题描述:
今天刚用aspnetpager控件来做分页,前台代码:
<>
AllowPaging="True" AllowSorting="True" PageSize="8" ShowHeader="False" Width="100%"
BorderWidth="0px">
<>
VerticalAlign="Middle" />
后台代码:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ System.Data.DataTable ds = BLL.Conn.prcg.GetDataTable("select * from Mir_News");
AspNetPager1.AlwaysShow = true;
AspNetPager1.PageSize = 5;
AspNetPager1.RecordCount = ds.Rows.Count;
GridView1.DataSource = ds;
GridView1.DataBind(); } }
private void DataBind()
{ System.Data.DataTable ds = BLL.Conn.prcg.GetDataTable("select * from Mir_News");
System.Data.DataTable dt2 = ds.Clone();
int m = AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1);
int n = AspNetPager1.PageSize * AspNetPager1.CurrentPageIndex;
for (int i = m; i < n; i++){
dt2.ImportRow(ds.Rows[i]); }
this.GridView1.DataSource = dt2;
this.GridView1.DataBind();}
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{ AspNetPager1.CurrentPageIndex = e.NewPageIndex;
DataBind();}
protected void AspNetPager1_PageChanged(object sender, EventArgs e) {
DataBind(); }
报错如下:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1061: 'ASP.human_webform1_aspx' does not contain a definition for 'AspNetPager1_PageChanged' and no extension method 'AspNetPager1_PageChanged' accepting a first argument of type 'ASP.human_webform1_aspx' could be found (are you missing a using directive or an assembly reference?)
请高手看看是什么问题