初始化(Initialization)
页面被请求时,第一个被执行的总是下面接着执行的是 接着是 然后是 恢复和加载(Restore and Load)
接下来的 ViewState 被取回后,接着 下一个是 然后才是 Raised Events
下一个方法,下一个方法, 下面是 接着是 保存和绘制(Save and Render)
下一个是 下面是 接着是 最后是 上面就是 page 的生命循环。每次有一个新的请求时,以上过程就重复一次。
Listing 1: Page 的事件小结
Method | PostBack | Controls |
Constructor | Always | All |
AddParsedSubObject | Always | All |
DeterminePostBackMode | Always | Page |
OnInit | Always | All |
|
||
LoadPageStateFromPersistenceMedium | PostBack | Page |
LoadViewState | PostBack | All |
ProcessPostData1 | PostBack | Page |
OnLoad | Always | All |
|
||
ProcessPostData2 | PostBack | Page |
RaiseChangedEvents | PostBack | Page |
RaisePostBackEvent | PostBack | Page |
OnPreRender | Always | All |
|
||
SaveViewState | Always | All |
SavePageStateToPersistenceMedium | Always | Page |
Render | Always | All |
OnUnload | Always | All |
|