There are two approaches to fix this error:
- Set the CurrentPageIndex = 0 when you bind data in the Page_EventHandler
- Allow the error to occur and then catch it in a try block resetting the index to 0 and rebinding the grid
VB.NET
try ’Bind the Data catch ex as ArgumentOutOfRangeException DataGrid1.CurrentPageIndex = 0; ’Bind the Data end try
C#
try { //Bind the Data } catch(ArgumentOutOfRangeException ex ) { DataGrid1.CurrentPageIndex = 0; //Bind the Data }
Share with