Master Page在运行时的行为

At run time, master pages are handled in the following sequence:

  1. Users request a page by typing the URL of the content page.

  2. When the page is fetched, the @ Page directive is read. If the directive references a master page, the master page is read as well. If this is the first time the pages have been requested, both pages are compiled.

  3. The master page with the updated content is merged into the control tree of the content page.

  4. The content of individual Content controls is merged into the corresponding ContentPlaceHolder control in the master page.

  5. The resulting merged page is rendered to the browser.

The process is illustrated in the following diagram.

Master pages at run time

 

IC147301

 

From the user's perspective, the combined master and content pages are a single, discrete page. The URL of the page is that of the content page.

From a programming perspective, the two pages act as separate containers for their respective controls. The content page acts as a container for the master page. However, you can reference public master-page members from code in the content page, as described in the next section.

 

Note that the master page becomes a part of the content page. In effect, the master page acts in much the same way a user control acts — as a child of the content page and as a container within that page

 

来源:

Run-time Behavior of Master Pages

http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx#RunTimeBehaviorOfMasterPages

posted on 2010-05-25 17:09  中道学友  阅读(238)  评论(0编辑  收藏  举报

导航

技术追求准确,态度积极向上