Master Pages Under the Hood


You may ask how these Master Pages really work. In this context, it's quite interesting to have a look at the control tree of generated pages. As you can see in Figure 4-5, the Master Page is being created as an independent control directly below the page itself. You can recognize the ContentPlaceHolder controls as well. They directly contain the objects that are being placed either in the Content Page or as default content in the Master Page.

click to expand
Figure 4-5: The control tree shows how ASP.NET is handling Master Pages.

If you want to work with events within the Master Page and/or the Content Page, you should watch out for the correct sequence:

  1. Master Page child controls initialization.

  2. Content Page child controls initialization.

  3. Master page initialization.

  4. Content Page initialization.

  5. Content Page load.

  6. Master Page load.

  7. Master Page child controls load.

  8. Content Page child controls load.




ASP. NET 2.0 Revealed
ASP.NET 2.0 Revealed
ISBN: 1590593375
EAN: 2147483647
Year: 2005
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net