Gridview Paging via ObjectDataSource: Why is maximumRows being set to -1?

octechnologist picture octechnologist · May 24, 2010 · Viewed 8.4k times · Source

So before I tried custom gridview paging via ObjectDataSource... I think I read every tutorial known to man just to be sure I got it. It didn't look like rocket science.

I've set the AllowPaging = True on my gridview.

I've specified PageSize="10" on my gridview.

I've set EnablePaging="True" on the ObjectDataSource.

I've added the 2 paging parms (maximumRows & startRowIndex) to my business object's select method.

I've created an analogous "count" method with the same signature as the select method.

The only problem I seem to have is during execution... the ObjectDataSource is supplying my business object with a maximumRows value of -1 and I can't for the life of me figure out why. I've searched to the end of the web for anyone else having this problem and apparently I'm the only one. The StartRowIndex parameter seems to be working just fine.

Any ideas?

Answer

Bruno F. picture Bruno F. · Jan 6, 2011

If SelectCountMethod is not specified the PageSize will be -1.