Problem with OnItemCreated and InitializePager being called four times

Discussion in 'ASP .Net Datagrid Control' started by Bernal Schooley, Apr 5, 2004.

  1. Hello,

    I'm hoping someone here can shed some light on this problem or suggest
    alternate approaches.

    I'm creating a custom datagrid by extending the standard one. In it
    I'm putting additional stuff in the pager section. My code will work
    by overriding either OnItemCreated or InitializePager, but both of
    those are called 4 times per page load. It's called twice between
    "Begin LoadViewState" and "End LoadViewState" and then twice between
    "Begin Raise PostBackEvents" and "End Raise PostBackEvents".

    The end result is only one set of my changes appears on the grid. I
    can only assume that the two calls are one for the top pager and one
    for the bottom pager, even when the top pager is not enabled. During
    the first two calls my CurrentPageIndex is the old number and then
    during the last two calls my CurrentPageIndex is the new number.

    My question is is there any way to tell from within the overridden
    method which call is for which pager (ie. top or bottom if that's what
    is happening) and if it's being called during the LoadViewState or
    PostBackEvents?

    Thanks for any thoughts you can share on the subject.

    Regards,
    --Bernal
     
    Bernal Schooley, Apr 5, 2004
    #1
    1. Advertisements

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. GfxGuy
    Replies:
    0
    Views:
    987
    GfxGuy
    May 4, 2005
  2. djskrill
    Replies:
    9
    Views:
    880
    djskrill
    Oct 1, 2003
  3. Apricot
    Replies:
    4
    Views:
    781
    velthuijsen
    Apr 16, 2004
  4. Radu
    Replies:
    7
    Views:
    951
    charlie_Stell
    Aug 28, 2009
  5. Pete Coolidge

    OnItemCreated and OnItemDataBound called too many times?

    Pete Coolidge, Jul 4, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    369
    Pete Coolidge
    Jul 4, 2003
  6. J055
    Replies:
    4
    Views:
    1,387
    Steven Cheng[MSFT]
    Jun 14, 2006
  7. Felix
    Replies:
    1
    Views:
    515
    Felix
    Sep 29, 2006
  8. Replies:
    0
    Views:
    234
Loading...