Items.Count wrong on partial page

Discussion in 'ASP .Net Datagrid Control' started by Paul, Jul 5, 2004.

  1. Paul

    Paul Guest

    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!
     
    Paul, Jul 5, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pikarde
    Replies:
    2
    Views:
    1,054
    Danny Bloodworth
    Nov 24, 2003
  2. Billy
    Replies:
    2
    Views:
    511
    Billy
    Feb 1, 2006
  3. Thomas Heller
    Replies:
    13
    Views:
    864
    Michele Simionato
    Feb 8, 2007
  4. J. Clifford Dyer

    Re: Partial 1.0 - Partial classes for Python

    J. Clifford Dyer, Feb 8, 2007, in forum: Python
    Replies:
    0
    Views:
    525
    J. Clifford Dyer
    Feb 8, 2007
  5. efelnavarro09
    Replies:
    2
    Views:
    941
    efelnavarro09
    Jan 26, 2011
Loading...

Share This Page