'GridView1' fired event PageIndexChanging which wasn't handled

谁说胖子不能爱 提交于 2019-12-05 01:58:53

You will have to handle the PageIndexChanging event for the grid

Something like

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;
    //Bind grid

}

It will not work if you enable paging. You also need to write the event handler for PageIndexChangeEvent. Check this link: http://forums.asp.net/post/1177923.aspx

You would need to code "PageIndexChanging" event to make it work. Add an event handler for the PageIndexChanging where you set the GridView.CurrentPage = e.NewPage...

Add one more event in HTML mark up for pagging.

OnPageIndexChanging="GridView1_PageIndexChanging"

Now handle same event from code behind

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    //Your code
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!