OnPageIndexChanging not working in GridView within UpdatePanel

Tags: ASP.Net, MS Ajax

I'm working on a demo ASP.Net page that has multiple User Controls (.ascx) and one of the user controls has the ScriptManager and the UpdatePanel. The GridView control is within the ContentTemplate of the UpdatePanel. I was trying few things and hitting my head against the wall to find out why my Paging is not working. The following lessons are leant:

  1. You have to have OnPageIndexChanging in order for GridView to do Paging.
  2. I had accidently set the ChildrenAsTriggers to false on the UpdatePanel so even if the OnPageIndexChanging fires, it will not update the Grid at all. Remove ChildrenAsTriggers from the UpdatePanel and the Paging should work fine.

Hope this helps someone!

No Comments