ASP.net中頁面事件的先後執行順序__.net

來源:互聯網
上載者:User

ASP.net中頁面事件的先後執行順序

<iframe border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_336_280.htm" frameborder="0" width="340" scrolling="no" height="282"></iframe>

  客戶發出POST請求-〉建立Page衍生類別,調用建構函式-〉調用Page類的IHttpHandler.ProcessRequest方法-〉啟用Page類的Init事件-〉調用Page類的CreateChildControls虛方法-〉從POST變數和VIEWSTATE中還原伺服器端控制項狀態-〉啟用Page類的Load事件-〉啟用伺服器端控制項事件-〉啟用Page類的PreRender事件-〉調用Page類的Render虛方法-〉調用Page類的RenderChildren虛方法-〉發送HTTP響應給用戶端-〉啟用Page類的Unload事件-〉丟棄Page衍生類別的執行個體。

   Page 執行中將按照如下順序啟用事件:
Page.PreInit
Page.Init
Page.InitComplite
Page.PreLoad
Page.Load
Page.LoadComplete
Page.PreRender
Page.PreRenderComplete

<iframe border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_468_60.htm" frameborder="0" width="470" scrolling="no" height="62"></iframe>   如果頁面從令一個頁面繼承,如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

<iframe border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_468_60.htm" frameborder="0" width="470" scrolling="no" height="62"></iframe>   如果使用了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

<iframe border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_468_60.htm" frameborder="0" width="470" scrolling="no" height="62"></iframe>   更進一步,如果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

 

<iframe border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_468_60.htm" frameborder="0" width="470" scrolling="no" height="62"></iframe>

<iframe border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_ads_468_15.htm" frameborder="0" width="470" scrolling="no" height="18"></iframe>

<iframe border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_syndication_468_60.htm" frameborder="0" width="470" scrolling="no" height="62"></iframe>

搜尋其它相關資源,請用Google搜尋:
<iframe border="0" name="I1" align="middle" marginwidth="1" marginheight="1" src="http://www.b199.cn/blog_ads/Google_search_40.htm" frameborder="0" width="460" scrolling="no" height="40"></iframe>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.