Page.Master Property

Gets the master page that determines the overall look of the page.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)

public MasterPage Master { get; }
/** @property */
public MasterPage get_Master ()

public function get Master () : MasterPage

Not applicable.

Property Value

The MasterPage associated with this page if it exists; otherwise, a null reference (Nothing in Visual Basic).

The Master property returns the MasterPage object associated with this page. This property is read-only; however, you can set properties on the MasterPage object it returns.

The Master property is valid only on pages that reference a master page in the MasterPageFile property. If you access the Master property on a page that does not reference a master page, a null reference (Nothing in Visual Basic) is returned. The contents of a master page are not available until after the PreInit event has been raised.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions