我爱Aspx >> Asp.Net >> ASP.NET 2.0中Page事件的执行顺序
今天很郁闷了,在一个表单中执行几个runat=server事件的时候不断的触发客户端的submit事件,于是想到了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
Ҷƪл˵?
ASP.NET Atlas 強力支援您期待已..[04-21]
在ASP.NET Atlas中调用Web Servi..[04-21]
文件压缩代码(为.Net2.0新增)[04-21]
ASP.NET 2.0+Atlas编写鼠标拖放程..[04-21]
ASP.NET2.0中Gridview中数据操作..[04-21]
ASP.NET 2.0中使用multiview控件[04-21]
ASP.NET 2.0中实现跨页面提交[04-21]
ASP.NET 2.0的页面缓存功能介绍[04-21]
c#.net通用基类[04-21]
共享.Net 图片上传的一个类库的源..[04-21]
雅虎搜虫大行动----快来抓毛毛虫..[04-21]
为什么XML文件的分析结果出现乱码..[04-21]
Google(谷歌)中国总部探密[来自..[04-21]
google弃用谷歌?李开复时代终结?..[04-21]
Picasa--来自google的优秀相片管..[04-21]
google搜索趋势图之china VS jap..[04-21]
创建Mashup调用远端WebService(G..[04-21]
ASP.NET Atlas 強力支援您期待已..[04-21]
在ASP.NET Atlas中调用Web Servi..[04-21]
webqq开始内测 腾讯公司 qq[04-21]