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.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 3 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 3 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004