Items.Count wrong on partial page

P

Paul

Hi, here's an odd one that blows my mind. I have a DataGrid with paging
enabled. I have PageSize=10. I have 25 total items, so that gives me
two pages=10 and the last page=5. Fine. When I access this last page
of 5 items in _ItemCommand(), I need an Item.Count, and I get 5 items.
Very good, I'm happy, life works.

Now I try to get the same Item.Count of 5 on the same page when I access
that page in _PageIndexChanged(). Not so good. This time it gives me
Item.Count=10. I get a range error. I'm clueless and not a happy
camper about this.

I know, I know, there is a good explanation for this aberrant behavior,
but what the hell is it?

In the _pageIndexChanged() code behind I am setting the CurrentPageIndex
= e.NewPageIndex and that appears to be correct (2). To my way of
thinking, once I do this then Items.Count should reflect reality (5),
but it doesn't.

This is truly strange. Any idea?

~Paul

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top