System.Web.UI.Page.MasterPageFile Property

Gets or sets the virtual path of the master page.

Syntax

[System.ComponentModel.DefaultValue("")]
public virtual string MasterPageFile { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The Page.MasterPageFile property is a virtual path (from the root of the application) of the master page file associated with this page. The Page.MasterPageFile property can be set only in the Page.PreInit event; attempting to set the Page.MasterPageFile property after the Page.PreInit event will throw an InvalidOperationException exception. If the Page.MasterPageFile property is not valid, an exception of type System.Web.HttpException is thrown later in the page life cycle, but no exception is thrown when the property is set in the Page.PreInit event.

Pages that have the Page.MasterPageFile property set are content pages, and therefore can contain only top-level controls that are System.Web.UI.WebControls.Content controls.

Requirements

Namespace: System.Web.UI
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0