In what order asp.net master pages execute

試著忘記壹切 提交于 2019-12-30 07:27:12

问题


I m using master page in my project. I want to know the order in which the page loads of both master page and web page executes also about the scripts


回答1:


  1. Master page child controls initialization: All server controls contained within the master page are first initialized.
  2. Content page child controls initialization: All server controls contained in the content page are initialized.
  3. Master page initialization: The master page itself is initialized.
  4. Content page initialization: The content page is initialized.
  5. Content page load: The content page is loaded (this is the Page_Load event followed by the Page_LoadComplete event).
  6. Master page load: The master page is loaded (this is also the Page_Load event).
  7. Master page child controls load: The server controls on the master page are loaded onto the page.
  8. Content page child controls load: The server controls on the content page are loaded onto the page.

http://it.toolbox.com/blogs/coding-dotnet/events-in-master-page-content-pages-16262




回答2:


From: https://msdn.microsoft.com/en-us/library/dct97kc3.aspx

The following is the sequence in which events occur when a master page is merged with a content page:

  1. Content page PreInit event.
  2. Master page controls Init event.
  3. Content controls Init event.
  4. Master page Init event.
  5. Content page Init event.
  6. Content page Load event.
  7. Master page Load event.
  8. Master page controls Load event.
  9. Content page controls Load event.
  10. Content page PreRender event.
  11. Master page PreRender event.
  12. Master page controls PreRender event.
  13. Content page controls PreRender event.
  14. Master page controls Unload event.
  15. Content page controls Unload event.
  16. Master page Unload event.
  17. Content page Unload event.


来源:https://stackoverflow.com/questions/4552097/in-what-order-asp-net-master-pages-execute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!