ASP.Net 事件循环顺序
我遇到了很多问题(通常是在上一页的按钮单击事件之前执行页面加载事件),因此我决定查找它并发布事件循环顺序:
Method Called Controls
------------------------------------------------------
1. Constructor Always All
2. AddParsedSubObject Always All
3. DeterminePostBackMode Always Page
4. OnInit Always All
5. LoadPageStateFromPersistenceMedium Postback Page
6. LoadViewState Postback All
7. ProcessPostData1 Postback Page
8. OnLoad Always All //Page Load
9. ProcessPostData2 Postback Page
10. RaiseChangedEvents Postback Page
11. RaisePostBackEvent Postback Page //Button Clicks
12. OnPreRender Always All //Put page load events here
13. SaveViewState Always All
14. SavePageStateToPersistenceMedium Always Page
15. Render Always All
16. OnUnload Always All
I've had so many problems with this (usually with page load events being executed before button click events from the previous page) that I decided to look it up and post the event loop ordering:
Method Called Controls
------------------------------------------------------
1. Constructor Always All
2. AddParsedSubObject Always All
3. DeterminePostBackMode Always Page
4. OnInit Always All
5. LoadPageStateFromPersistenceMedium Postback Page
6. LoadViewState Postback All
7. ProcessPostData1 Postback Page
8. OnLoad Always All //Page Load
9. ProcessPostData2 Postback Page
10. RaiseChangedEvents Postback Page
11. RaisePostBackEvent Postback Page //Button Clicks
12. OnPreRender Always All //Put page load events here
13. SaveViewState Always All
14. SavePageStateToPersistenceMedium Always Page
15. Render Always All
16. OnUnload Always All
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是当您拥有母版页时所涉及的事件的完整列表:
Here's a complete list of the events that are involved when you have masterpages as well: