I have an ASP.Net 3.5 web page with a GridView that's bound to an ObjectDataSource. Paging and sorting have been enabled and everything works fine when the DataSource returns data. In certain instances when the DataSource returns null or an Empty collection, the GridView retains the paging from the previous Select instead of hiding the GridView due to an empty result set.
I have a parameter being passed to the ObjectDataSource that can be used to filter the results. When this parameter causes the DataSource to return null or an Empty collection, the paging doesn't reset. I have checked that the Select Method used by the ODS is actually returning and empty collection (List<>) and that the Count Method used by the ODS is returning zero.
If I click the search button a second time, the GridView becomes hidden as I would have expected it to do the first time.
If I need to give more information I would be happy to, but that I think that sums up the problem for now.
Any help is greatly appreciated. Thanks.
Whats about (as you said you have a button for searching) to refresh the gridview after the user has pressed the button, or to check the result before and then clear the grid if the result is empty.