Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount..
How to Prevent This Error in asp.net
We will get this error when ever we are in the second page in the datagrid or grid view and clicking on the search button or performing any action like binding the data to grid.
I got this error recently (Invalid CurrentPageIndex value. It must be >= 0 and < the Page Count) and I soled like this.
In the datagrid I was in the second page and I clicked on the search button…before binding the data to datagrid ..i got the following error..
Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount
Means u r in the second page then..cuurrentpageindex=1
After clicking on the search button make the currentpageindex=0
Then bind the data to grid.
Like this
private void btnSearch_Click (object sender, System.EventArgs e)
{
datagrid.CurrentPageIndex=0;
BindGrid ();
}
Read my more asp.net articles at
common elements from the two arrays
Exporting Datagrid to excel or worddoc using asp.net
Sending email using asp.net1.1
