ASP.net Gridview Paging doesin't work inside UpdatePanel ASP.net Gridview Paging doesin't work inside UpdatePanel ajax ajax

ASP.net Gridview Paging doesin't work inside UpdatePanel


The solution is that you should refill the dataset which is used to populate the gridview, each time your page index is changed. By this way, you could ensure that in each seperate postback which has been triggered by the gridview page number, results will be populated.


I just tried that above code. I had same issue and now it is working just fine.

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) {     GridView1.PageIndex = e.NewPageIndex;             GridView1.DataBind();     //  UpdatePanel2.Update();   <-- Remove this line from your code.} 

I have GridView inside update panel. Did you write your event PageIndexChanging in your .aspx file also?

Hope this helps.


Further research:

http://msdn.microsoft.com/en-us/library/cc295545.aspx

Controls that are not compatible with UpdatePanel controls

The following ASP.NET controls are not compatible with partial-page updates, and are therefore not designed to work inside an UpdatePanel control:

  • GridView and DetailsView controls when their EnableSortingAndPagingCallbacks property is set to true. The default is false.