hi!
i am using datagrid to display data and i provide Pageing to the datagrid and i write code like
Protected Sub DataGrid1_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged
DataGrid1.CurrentPageIndex = e.NewPageIndex
BindGrid()
End Sub
when i click next i shown next Records and also previous Records. i give pagesize = 10.
my problem is when i delete all records off 2nd page (or) 3rd page it shows error i.e.,
"Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount."
Please give code to solve this error. Please urgent sir.
Thanks.
Error in Datagrid Page Index changed.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

VasanthRank #1,486 · 1.1K reputationPosted Apr 20, 2010, 6:26 AM EDT
DataGrid1.CurrentPageIndex = 0
Please mark as answer , if it helps you.