{"id":10,"date":"2008-08-06T07:39:19","date_gmt":"2008-08-06T05:39:19","guid":{"rendered":"http:\/\/dev.flauschig.ch\/wordpress\/?p=10"},"modified":"2009-08-21T08:56:39","modified_gmt":"2009-08-21T06:56:39","slug":"postback-event-processing-sequence","status":"publish","type":"post","link":"http:\/\/dev.flauschig.ch\/wordpress\/?p=10","title":{"rendered":"Postback Event Processing Sequence"},"content":{"rendered":"<p>ASP is pretty much Event-Oriented. So it&#8217;s important to know the exact Sequence of the Events for a Page-Life-Cycle.<\/p>\n<p>Here&#8217;s the List (in sequence):<!--more--><\/p>\n<ol>\n<li><strong>Page.Init + Control.Init for every Control on the WebForm<\/strong><br \/>\nThe first Stage in the Page life cycle is Initialization. After the Page&#8217;s Control-Tree is populated with all the statically declared Controls in the .aspx Source the Init Event is fired. First, the Init Event for the Page Object occurs, then Init Event occurs for each Control on the Page. ViewState Information is not available at this Stage.<\/li>\n<li><strong>Page.LoadViewState<\/strong><br \/>\nAfter Initialization, ASP.NET loads the ViewState for the Page. ViewState contains the State of the Controls the last time the Page was processed on the Server.<\/li>\n<li><strong>Page.ProcessPostData<\/strong><br \/>\nPost Data gets read from the Request and Control Values are applied to Controls initalized in Stage 1.<\/li>\n<li><strong>Page.Load + Control.Load for each Control on the Page<\/strong><br \/>\nIf this is the first time the Page is being processed (Page.IsPostback Property), initial data binding is performed here.<\/li>\n<li><strong>&#8220;Change&#8221; events are fired for Controls (TextChanged, SelectedIndexChanged, and similar)<\/strong><br \/>\nThe current Value (from Post Data) is compared to the original Value located in the ViewState. If there is a difference &#8220;Changed&#8221; Events are raised.<\/li>\n<li><strong>Server-Side Events are fired for any Validation Controls<\/strong><\/li>\n<li><strong>Button.Click + Button.Command<\/strong><br \/>\nThe Click and Command Events are fired for the Button that caused the Postback<\/li>\n<li><strong>Page.PreRender + Control.PreRender<\/strong><\/li>\n<li><strong>Page.SaveViewState<\/strong><br \/>\nNew Values for all the Controls are saved to the ViewState for another round-trip to the Server.<\/li>\n<li><strong>Page.Render<\/strong><\/li>\n<\/ol>\n<p>There&#8217;s more Information in MSDN: <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa479007.aspx\">The ASP.NET Page Object Model<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ASP is pretty much Event-Oriented. So it&#8217;s important to know the exact Sequence of the Events for a Page-Life-Cycle. Here&#8217;s the List (in sequence):<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5,3],"tags":[11,62,63,64,61,60,59],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-roemer","4":"has-more-link","5":"post-10","7":"format-standard","8":"category-asp","9":"category-programming","10":"post_tag-control","11":"post_tag-pageload","12":"post_tag-pageprerender","13":"post_tag-pagerender","14":"post_tag-post","15":"post_tag-viewstate","16":"post_tag-webform"},"acf":[],"views":6111,"_links":{"self":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10"}],"collection":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10"}],"version-history":[{"count":0,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10\/revisions"}],"wp:attachment":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}