order of Event Handling and Posting Page_Load..?

Discussion in 'ASP .Net Datagrid Control' started by cj, May 11, 2005.

  1. cj

    cj Guest

    I am using datagrids with buttoncolumn etc. I am trying to understand the
    order of events.

    If a user clicks on a ButtonColumn button, what is the order of events after
    that? Does the event-handler subroutine happen before the Page_Load
    subrouting, or the other way around?

    Also, I assume the state of any variables etc will be updated before either
    Page_Load or event handler subroutines?

    Can someone please clarify this?

    Thanks

    cj
     
    cj, May 11, 2005
    #1
    1. Advertising

  2. cj

    Teemu Keiski Guest

    Hi,

    Page_Load happens always before postback events. And other way around,
    postback events raised by controls are raised always after Page_Load.

    With State of variables : if you mean local variables / members on the Page
    they do not keep their state by default (Page class is recreated for every
    request), however those which utilize ViewState (controls itself do), they
    do keep their state and are restored to the state (from previous
    postback/request by the same user) before Pgae_Load (actually right after
    Page_Init)

    In case you are interested in the Page lifecycle (the phases during one
    request).

    ASP.NET 1.0/1.1

    1. Instantiate
    2. Initialize
    3. TrackViewState
    4. LoadViewState (postback)
    5. Load postback data (postback, IPostBackDatahandler.LoadPostdata)
    6. Load
    7. Load postback data for dynamical controls added on Page_Load (postback)
    8. Raise Changed Events (postback,
    IPostBackDatahandler.RaisePostDataChanged)
    9. Raise postback event (postback, IPostBackEventHandler.RaisePostBackEvent)
    10.PreRender
    11. SaveViewState
    12. Render
    13. Unload
    14. Dispose

    ASP.NET 2.0 has added a support for a few more stages. Here's a nice diagram
    of all the relevant phases in v2

    http://hydrate.typepad.com/leo/2004/08/the_aspnet_v20_.html

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU


    "cj" <> wrote in message
    news:428182f1$0$266$...
    >I am using datagrids with buttoncolumn etc. I am trying to understand the
    >order of events.
    >
    > If a user clicks on a ButtonColumn button, what is the order of events
    > after that? Does the event-handler subroutine happen before the Page_Load
    > subrouting, or the other way around?
    >
    > Also, I assume the state of any variables etc will be updated before
    > either Page_Load or event handler subroutines?
    >
    > Can someone please clarify this?
    >
    > Thanks
    >
    > cj
    >
     
    Teemu Keiski, May 13, 2005
    #2
    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. bminder
    Replies:
    1
    Views:
    2,200
    nfedin
    Feb 23, 2004
  2. Skating_vince
    Replies:
    2
    Views:
    422
    Skating_vince
    Aug 13, 2004
  3. z. f.
    Replies:
    0
    Views:
    580
    z. f.
    Oct 19, 2004
  4. Kaidi
    Replies:
    1
    Views:
    325
    Thomas Weidenfeller
    Nov 5, 2004
  5. rockdale
    Replies:
    1
    Views:
    685
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
Loading...

Share This Page