System.Web
2.0.0.0
System.Web.UI.UserControl
System.Web.UI.ControlBuilder(typeof(System.Web.UI.MasterPageControlBuilder))
System.Web.UI.ParseChildren(false)
A master page functions as a template container and merging page for content pages in your ASP.NET Web application. Master pages provide a convenient way to share structure and content across a set of content pages. You use content placeholders to define the sections of the master page to replace with content from the content pages.
When you use a master page and its related content pages, you add the required XHTML document tags (such as html, head, and body) only to the master page and no longer create your other .aspx files (ASP.NET pages) as stand-alone Web pages. The content pages define the content to insert into the placeholders in the master page.
When an HTTP request is made for a page at run time, the master page and content pages are combined into a single class with the same name as the content pages. The resulting compiled, merged class derives from the class.
A master page can contain direct markup and server controls, as well as container controls. Every element that is placed in the master page outside of a control is rendered on all pages that result from merging the master page and content pages.
Each content page that is related to the master page must reference the master page in a MasterPageFile attribute of its @ Page directive. Content pages can contain only a @ Page directive and one or more controls. All of your page text, markup, and server controls must be placed within controls. You identify the control of a master page that a control is associated with by setting the property of the control.
At run time, the dynamic content from each control in the requested page is merged with the master page in the exact location of the related control. Any other markup and controls in the master page are unaffected. Event handlers can be defined in both the master class and on the content page. For more information, see Events in Master and Content Pages.
The class is associated with files that have a .master extension. These files are compiled at run time as objects and are cached in server memory.
The master page is made available to the content page through the property of the base class. The property returns the instance of the master page; however, it is typed as the base class. To access controls, properties, and functions of the master page, the property can be cast to a object. The class name of the master page is defined using the ClassName attribute of the @ Master directive.
Files with .master extensions are not served to a browser.
The directives that are valid on a master page are the same as those that are available on a object. They can include the following attributes:
-
AutoEventWireup
-
ClassName
-
CodeFile
-
CompilerMode
-
CompilerOptions
-
Debug
-
Description
-
EnableTheming
-
EnableViewState
-
Explicit
-
Inherits
-
Language
-
LinePragmas
-
MasterPageFile
-
Src
-
Strict
-
WarningLevel
Master page directives do not override the directives on individual content pages.
Master pages are most often created declaratively. If you want to create a master page programmatically, derive directly from the class. In addition to extending the class, you must create the .master file to visually display the user interface (UI) that is associated with the classes that you have invoked in your source file.
When you create a master page by creating your own class first, you must include all namespaces that are required for the classes that are used by the page.
For more information about master pages, see ASP.NET Master Pages Overview.
Acts as a template and merging container for pages that are composed only of controls and their respective child controls.
Constructor
To be added.
Creates a new instance of the class.
2.0.0.0
Method
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.Void
Derived master page classes can add controls to the dictionary using the method. Derived types do not typically override the method.
Adds a control to the dictionary.
A unique name for the .
The .
Property
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.ComponentModel.Browsable(false)
System.Collections.IList
To be added.
Derived master page classes access the property to list the current controls that are contained by the master. Derived types do not typically override the property.
Gets a list of controls that the master page uses to define different content regions.
Property
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.ComponentModel.Browsable(false)
System.Collections.IDictionary
To be added.
Derived master page classes access the property to retrieve the current controls, as defined by associated content pages. Derived types do not typically override the property.
Gets a list of content controls that are associated with the master page.
Property
System.ComponentModel.Browsable(false)
System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
System.Web.UI.MasterPage
To be added.
The property is read-only, because master page hierarchies cannot be built at run time.
Gets the parent master page of the current master in nested master pages scenarios.
2.0.0.0
Property
System.ComponentModel.DefaultValue("")
System.String
To be added.
To be added.
Gets or sets the name of the master page that contains the current content.
2.0.0.0