V
Vince13
I'm fairly new to c# and Visual Studio. I've been having what seems like a
common paging problem. When I try to change pages (even just from the first
page to the second), the error comes up:
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
I have found many solutions on different websites, but they all have to do
with deleting entries on a page and then trying to use a CurrentPageIndex
larger than the PageCount. However, I have checked both of these variables
and they should be fine. I even added an if statement to guard against it
and the error still comes up.
if (DataGrid1.CurrentPageIndex >= 0 && DataGrid1.CurrentPageIndex <
DataGrid1.PageCount)
{
DataGrid1.DataBind();
}
If there is anyone who can give me any idea where to start to fix this
problem, I would greatly appriciate it.
common paging problem. When I try to change pages (even just from the first
page to the second), the error comes up:
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
I have found many solutions on different websites, but they all have to do
with deleting entries on a page and then trying to use a CurrentPageIndex
larger than the PageCount. However, I have checked both of these variables
and they should be fine. I even added an if statement to guard against it
and the error still comes up.
if (DataGrid1.CurrentPageIndex >= 0 && DataGrid1.CurrentPageIndex <
DataGrid1.PageCount)
{
DataGrid1.DataBind();
}
If there is anyone who can give me any idea where to start to fix this
problem, I would greatly appriciate it.