Ok,
Here is what is happening.
1. I have a page with a datagrid. This datagrid enables paging which
is accomplished through the following line of code:
grdADData.CurrentPageIndex = e.NewPageIndex (this happens in the
Grid's PageIndexChanged event)
2. Now lets assume that when my grid is originally bound to a dataset,
it's a very large dataset so the user could likely page through it a
lot. To be more specific, let's say they page to the end. That grid
now holds a number reprenting how many pages it has iterated
over...remember, we are talking paging, not pages in the .aspx sense.
That page value is in the CurrentPageIndex property.
3. Now let's say the user wants to load that grid again with different
data, only this time there is a much smaller dataset. When Databind is
called, an error is thrown because the new dataset doesn't have as many
pages to go through so the index of the CurrentPageIndex is out of
bounds.
4. So, what needs to happen is that I need to do is clear that grid's
CurrentPageIndex should the user databind to a smaller dataset than the
one they had been paging through before.
5. At this point I realize that this is tedious.
6. The easiest way around this seems to me to just simply set the
CurrentPageIndex to 0 in an error handler and then reload the page. I
realize that I may not need the server to think it's the first load, I
just want to reload the page.
Hope that helps
Thanks for looking at this