troubleshooting Question

GridView doesn't refresh paging when ObjectDataSource returns empty collection.

Avatar of perksdev
perksdev asked on
.NET ProgrammingASP.NET
3 Comments1 Solution1155 ViewsLast Modified:
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.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros