在網路上看到的一個網址: http://www.cnblogs.com/DavidFan/archive/2007/05/17/750083.html

Asp.NET 2.0
Page事件的執行順序

 
Page
執行中將按照如下順序啟動事件:

Page.PreInit
Page.Init
Page.InitComplite
Page.PreLoad
Page.Load
Page.LoadComplete
Page.PreRender
Page.PreRenderComplete

如果頁面從令一個頁面繼承,如BasePage:System.Web.UI.Page,在BasePage中做了一些擴展,如許可權檢查,而其他頁面從BasePage繼承,則BasePage和最終Page的事件啟動順序是:

UI.PreInit
Page.PreInit
UI.Init
Page.Init
UI.InitComplite
Page.InitComplite
UI.PreLoad
Page.PreLoad
UI.Load
Page.Load
UI.LoadComplete
Page.LoadComplete
UI.PreRender
Page.PreRender
UI.PreRenderComplete
Page.PreRenderComplete

如果使用了MasterPage,則MasterPage中的事件和ContentPage中的事件按照下面順序啟動:

ContentPage.PreInit
Master.Init
ContentPage.Init
ContentPage.InitComplite
ContentPage.PreLoad
ContentPage.Load
Master.Load
ContentPage.LoadComplete
ContentPage.PreRender
Master.PreRender
ContentPage.PreRenderComplete

更進一步,如果ContentPage繼承BasePage,那麼,各事件的執行順序將變成:

UI.PreInit
ContentPage.PreInit
Master.Init
UI.Init
ContentPage.Init
UI.InitComplite
ContentPage.InitComplite
UI.PreLoad
ContentPage.PreLoad
UI.Load
ContentPage.Load
Master.Load
UI.LoadComplete
ContentPage.LoadComplete
UI.PreRender
ContentPage.PreRender
Master.PreRender
UI.PreRenderComplete
ContentPage.PreRenderComplete
(
內容來自網路)

 

文章標籤
全站熱搜
創作者介紹
創作者 mming 的頭像
mming

系統小雜工,專記ㄚ沙不魯的東西

mming 發表在 痞客邦 留言(0) 人氣(2,193)