Saturday, April 30, 2005
by Nik Kalyani
Saturday, April 30, 2005 6:37:28 AM (Pacific Standard Time, UTC-08:00)

Order of events in the lifecycle of an ASP.Net page:

    Phase What a control needs to do Method or event to override
    Initialize Initialize settings needed during the lifetime of the incoming Web request. Init event (OnInit method)
    Load view state At the end of this phase, the ViewState property of a control is automatically populated as described in Maintaining State in a Control. A control can override the default implementation of the LoadViewState method to customize state restoration. LoadViewState method
    Process postback data Process incoming form data and update properties accordingly. LoadPostData method (if IPostBackDataHandler is implemented)
    Load Perform actions common to all requests, such as setting up a database query. At this point, server controls in the tree are created and initialized, the state is restored, and form controls reflect client-side data. Load event

    (OnLoad method)

    Send postback change notifications Raise change events in response to state changes between the current and previous postbacks. RaisePostDataChangedEvent method (if IPostBackDataHandler is implemented)
    Handle postback events Handle the client-side event that caused the postback and raise appropriate events on the server. RaisePostBackEvent method(if IPostBackEventHandler is implemented)
    Prerender Perform any updates before the output is rendered. Any changes made to the state of the control in the prerender phase can be saved, while changes made in the rendering phase are lost. PreRender event
    (OnPreRender method)
    Save state The ViewState property of a control is automatically persisted to a string object after this stage. This string object is sent to the client and back as a hidden variable. For improving efficiency, a control can override the SaveViewState method to modify the ViewState property. SaveViewState method
    Render Generate output to be rendered to the client. Render method
    Dispose Perform any final cleanup before the control is torn down. References to expensive resources such as database connections must be released in this phase. Dispose method
    Unload Perform any final cleanup before the control is torn down. Control authors generally perform cleanup in Dispose and do not handle this event. UnLoad event (On UnLoad method)
  1. Note   To override an EventName event, override the OnEventName method (and call base. OnEventName).
  2. Name
    E-mail
    (will show your gravatar icon)
    Home page

    Comment (Some html is allowed: a@href@title, b, i, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

    Enter the code shown (prevents robots):

    Live Comment Preview
    RSS feed
    Search and Links
    Bling

    View Nik Kalyani's profile on LinkedIn

    Contact me: nik*kalyani.com (replace "*")

    TechBubble
    www.flickr.com
    This is a Flickr badge showing public photos from techbubble. Make your own badge here.
    Statistics
    Total Posts: 214
    This Year: 32
    This Month: 0
    This Week: 0
    Comments: 238
    About the author/Disclaimer

    Disclaimer
    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008
    Nik Kalyani
    Sign In
    All Content © 2008, Nik Kalyani