Events in ASP.NET Master and Content Pages
2011-11-20 22:11
971 查看
http://msdn.microsoft.com/en-us/library/dct97kc3.aspx
http://msdn.microsoft.com/en-us/library/ms178472.aspx
The following is the sequence in which events occur when a master page is merged with a content page:
Content page PreInit event.
Master page controls Init event.
Content controls Init event.
Master page Init event.
Content page Init event.
Content page Load event.
Master page Load event.
Master page controls Load event.
Content page controls Load event.
Content page PreRender event.
Master page PreRender event.
Master page controls PreRender event.
Content page controls PreRender event.
Master page controls Unload event.
Content page controls Unload event.
Master page Unload event.
Content page Unload event.
The sequence of events in master and content pages rarely is important for you as page developer. However, if you are creating event handlers that depend on the availability of certain controls, you will find it helpful to understand the event sequence in master
and content pages.
Note: Some Terms Explanation
PreRender:Use the event to make final changes to
the contents of the page or its controls before the rendering stage begins.
Render: This is not an event; instead, at this stage of processing, the Page object
calls this method on each control. All ASP.NET Web server controls have a Render method
that writes out the control's markup to send to the browser.
Unload:
Raised for each control and then for the page. In controls, use this event to do final cleanup for specific controls, such as closing control-specific database connections.
http://msdn.microsoft.com/en-us/library/ms178472.aspx
The following is the sequence in which events occur when a master page is merged with a content page:
Content page PreInit event.
Master page controls Init event.
Content controls Init event.
Master page Init event.
Content page Init event.
Content page Load event.
Master page Load event.
Master page controls Load event.
Content page controls Load event.
Content page PreRender event.
Master page PreRender event.
Master page controls PreRender event.
Content page controls PreRender event.
Master page controls Unload event.
Content page controls Unload event.
Master page Unload event.
Content page Unload event.
The sequence of events in master and content pages rarely is important for you as page developer. However, if you are creating event handlers that depend on the availability of certain controls, you will find it helpful to understand the event sequence in master
and content pages.
Note: Some Terms Explanation
PreRender:Use the event to make final changes to
the contents of the page or its controls before the rendering stage begins.
Render: This is not an event; instead, at this stage of processing, the Page object
calls this method on each control. All ASP.NET Web server controls have a Render method
that writes out the control's markup to send to the browser.
Unload:
Raised for each control and then for the page. In controls, use this event to do final cleanup for specific controls, such as closing control-specific database connections.
相关文章推荐
- 海洋工作室——网站建设专家:Events in ASP.NET Master and Content Pages
- Calling JavaScript from ASP.NET Master Page and Content Pages
- Working with Data in ASP.NET 2.0 :: Master Pages and Site Navigation
- Using SiteMap and MasterPages to set META Tags in ASP.NET and C#
- 海洋工作室——网站建设专家:Calling JavaScript from ASP.NET Master Page and Content Pages - Part I
- 海洋工作室——网站建设专家:Calling JavaScript from ASP.NET Master Page and Content Pages - Part II
- ASP.NET 2.0 MasterPages and FindControl()
- Master Pages In ASP.NET 2.0
- [翻译]Accessing and Updating Data in ASP.NET 2.0: Examining the Data Source Control's Events
- 页面压缩 Enabling Gzip and Deflate HTTP Compression in ASP.NET pages(转)
- 【ASP.NET Step by Step】之三 Master Pages and Site Navigation
- Master Pages In ASP.NET 2.0
- securely implement request processing, filtering and content redirection with HTTP pipeline in ASP.NET
- Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages
- Master Pages In ASP.NET 2.0
- Dynamically creating bound and template columns in GridView using ASP.Net
- [转]Using $select, $expand, and $value in ASP.NET Web API 2 OData
- How to programmatically assign a SkinID to a control while using a master page in ASP.net 2.0
- Event in Master Page, Content Page and User Control
- ASP.NET WebForms and MVC together in one project