运行时出现“无法将类型为“System.EventArgs”的对象强制转换为类型“Wuqi.Webdiyer.PageChangingEventArgs”
public void AspNetPager1_PageChanged(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
AspNetPager1.CurrentPageIndex = e.NewPageIndex;
//AspNetPager1.CurrentPageIndex = ((Wuqi.Webdiyer.PageChangingEventArgs) e).NewPageIndex;
BindGridView();
}
解决办法:
AspNetPager1.CurrentPageIndex = ((Wuqi.Webdiyer.PageChangingEventArgs) e).NewPageIndex;
换成这个
(sender as AspNetPager).CurrentPageIndex.
另外你试下,这个.CurrentPageIndex是否可以不写,本身已有页索引了
最终代码如下:
public void AspNetPager1_PageChanged(object src, EventArgs e)
{
BindGridView();
}