惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Y
Y Combinator Blog
F
Fortinet All Blogs
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
博客园 - Franky
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
量子位
博客园 - 三生石上(FineUI控件)
I
InfoQ
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿
D
Docker
美团技术团队
雷峰网
雷峰网
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理

博客园 - 老D

.NET Memcached Client 扩展获取所有缓存Key SQL Server 2005 中新CTE语法 递归性能测试 合并 GridView 的单元格 在Crystal Report中将数字转为英文 连接远程服务器共享 在代码中恢复sql server 数据库 - 老D 获取同一网段内的SQL SERVER实例 C#动态加载DLL Asp.net 文件下载 在网页处理按键事件 - 老D - 博客园 SQL语句导入导出大全 跨应用程序进行 Forms 身份验证 GridView导出Excel ASP.NET数据库连接字符串的加密与解密 ASP.NET中GridView动态绑定数据实现编辑更新 批量insert数据 简繁转换 ASP.NET应用程序开发 经典算法-C#四种排序算法
ASp.NET 2.0中Page事件的执行顺序
老D · 2007-07-14 · via 博客园 - 老D

Posted on 2007-07-14 11:34  老D  阅读(835)  评论()    收藏  举报

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