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. 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. djskrill
    Replies:
    9
    Views:
    701
    djskrill
    Oct 1, 2003
  2. Andrew Robinson

    GridView overriding InitializePager

    Andrew Robinson, Apr 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    2,179
    Steven Cheng[MSFT]
    Apr 13, 2007
  3. Pete Coolidge

    OnItemCreated and OnItemDataBound called too many times?

    Pete Coolidge, Jul 4, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    244
    Pete Coolidge
    Jul 4, 2003
  4. J055
    Replies:
    4
    Views:
    755
    Steven Cheng[MSFT]
    Jun 14, 2006
  5. Felix
    Replies:
    1
    Views:
    343
    Felix
    Sep 29, 2006
Loading...

Share This Page