Monday, January 21, 2019
  • Home
  •             

Events Fire Ordering in Master page / Content Pages

May 31st, 2007 by kenlin@HK [MVP]

Recent I work a lot on the Web Application in .NET 2.0. I tried to use the MasterPage with ContentPage. However, I found out that the even fire is…..not in general ordering. ie, I have one MasterPage and one ContentPage, A button in that ContentPage, When you click the button in debug mode, you will found out that the

1) ContentPage.Load fire;
2) then MasterPage.Load;
3) ContentPage.Button.Click.

When you work with master pages and content pages, both can use the same events (such as Page_Load).Be sure you know which events come before others. You are bringing two classes together to create a singlepage class, and a specific order is required. When an end user requests a content page in the browser, the event ordering is as follows:Master page child controls initialization: All server controls contained within the master page are first initialized.
Content page child controls initialization: All server controls contained in the content page are initialized.
Master page initialization: The master page itself is initialized.
Content page initialization: The content page is initialized.
Content page load: The content page is loaded (this is the Page_Load event followed by the Page_LoadComplete event).
Master page load: The master page is loaded (this is also the Page_Load event).
Master page child controls load: The server controls on the master page are loaded onto the page.
Content page child controls load: The server controls on the content page are loaded onto the page.

Anyway, I have some problem now, cause I have to set the value when button.click and get the value when another/same contentPage load. But….Ordering is…..Button.Click is fire the last. I have to search more in order to solve it.

Posted in .NET Framework, Reviews | Comments Off on Events Fire Ordering in Master page / Content Pages


This entry was posted on Thursday, May 31st, 2007 at 3:56 pm and is filed under .NET Framework, Reviews. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.


Comments are closed.