Professional Web Applications Themes

order of Event Handling and Posting Page_Load..? - ASP.NET Data Grid Control

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...

  1. #1

    Default order of Event Handling and Posting Page_Load..?

    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 Guest

  2. #2

    Default Re: order of Event Handling and Posting Page_Load..?

    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

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

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


    "cj" <cjohnsonwcc.qld.edu.au> wrote in message
    news:428182f1$0$266$61c65585uq-127creek-reader-03.brisbane.pipenetworks.com.au...
    >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 Guest

Similar Threads

  1. Call The Page_load Event
    By Artur in forum ASP Components
    Replies: 1
    Last Post: February 4th, 01:09 AM
  2. No Page_Load event when aspx is in iFrame?
    By Stevie_mac in forum ASP.NET General
    Replies: 3
    Last Post: August 12th, 08:21 PM
  3. Access to Page_Load Event from the .ascx control
    By Nikolaus Hruska in forum ASP.NET Building Controls
    Replies: 0
    Last Post: July 2nd, 03:04 PM
  4. Page_Load event doesn't appear in the trace
    By William F. Robertson, Jr. in forum ASP.NET General
    Replies: 0
    Last Post: June 25th, 04:07 PM
  5. .ascx page_load event
    By MeDhanush in forum ASP.NET General
    Replies: 1
    Last Post: June 25th, 02:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139