GridView 激发了未处理的事件“PageIndexChanging”
在手动给Gridview邦定数据源时(不是前台利用DataSource控件绑定),会出现这种情况:
运行后直接显示分页的1,只有1显示正常,如果点选其它的,比如2或者4什么其它别的,提示:
GridView“XXX”激发了未处理的事件“PageIndexChanging”。
手动分页必须有PageIndexChanging事件,添加PageIndexChanging事件,然后添加如下代码:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
this.GridView1.DataSource = BindData();
this.GridView1.DataBind();
}
{
this.GridView1.PageIndex = e.NewPageIndex;
this.GridView1.DataSource = BindData();
this.GridView1.DataBind();
}
本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利
This posting is provided "AS IS" with no warranties, and confers no rights.
This posting is provided "AS IS" with no warranties, and confers no rights.
浙公网安备 33010602011771号