Control.Page Property

Gets a reference to the Page instance that contains the server control.

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

<BindableAttribute(False)> _
Public Overridable Property Page As Page
Dim instance As Control
Dim value As Page

value = instance.Page

instance.Page = value
/** @property */
public Page get_Page ()

/** @property */
public void set_Page (Page value)

public function get Page () : Page

public function set Page (value : Page)

Not applicable.

Property Value

The Page instance that contains the server control.

Exception typeCondition


The control is a Substitution control.

This property's value reflects the name of the .aspx file that contains the server control.

The following example overrides the Control.Render method. It uses the Page property to access the Page.IsPostBack property and determine whether the page that contains this control has just been loaded for the first time or is the result of a postback.

Protected Overrides Sub Render(output As HtmlTextWriter)
   output.Write("Welcome to Control Development!<br>")
   ' Test if the page is loaded for the first time
   If Not Page.IsPostBack Then
      output.Write("Page has just been loaded")
      output.Write("Postback has occured")
   End If
End Sub 

protected void Render(HtmlTextWriter output)
    output.Write("Welcome to Control Development!<br>");

    // Test if the page is loaded for the first time
    if (!(get_Page().get_IsPostBack())) {
        output.Write("Page has just been loaded");
    else {
        output.Write("Postback has occured");
} //Render 

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, 1.1, 1.0

Community Additions