ASP.NET programming encountered a problem with GridView that triggered the unhandled event 'PageIndexChanging'
- 2020-05-09 18:27:47
- OfStack
Studied by struggling to the problem later in the afternoon, finally 1 some information from the Internet to find the answer, the reason should be manual programming of data source in ViewState didn't keep problem, cause PostBack 1 denier, the content of the data source is lost, so the solution is in GridView "PageIndexChanging" event specified in the new page and then a new data source binding.
The code is as follows:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
/* -- rewrite once the previous binding data source code -- */
}
The code is as follows:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
/* -- rewrite once the previous binding data source code -- */
}