views:

762

answers:

2

I have a datagrid with paging enabled. I am displaying the results in datagrid based on a filtering condition. I have filtered the data and it has now 2 pages. when i go to 2 nd page. and i am doing the seacrhing function once again to narrow down the results. Then I am getting an error like "Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount+datagrid paging" I am sure that the second search will produce only less number of pages than the previous one. How to solve ths problem ? Thanks in advance

+1  A: 

When you make certain changes, you need to reset to page 1. That includes filtering changes. Pretty much, any time you change the number of rows that might be available to your grid, go back to page 1.

John Saunders