Breyta

Deila með


Control.Page Property

Definition

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

public:
 virtual property System::Web::UI::Page ^ Page { System::Web::UI::Page ^ get(); void set(System::Web::UI::Page ^ value); };
[System.ComponentModel.Browsable(false)]
public virtual System.Web.UI.Page Page { get; set; }
[System.ComponentModel.Browsable(false)]
[System.ComponentModel.Bindable(false)]
public virtual System.Web.UI.Page Page { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Page : System.Web.UI.Page with get, set
[<System.ComponentModel.Browsable(false)>]
[<System.ComponentModel.Bindable(false)>]
member this.Page : System.Web.UI.Page with get, set
Public Overridable Property Page As Page

Property Value

The Page instance that contains the server control.

Attributes

Exceptions

The control is a Substitution control.

Examples

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 override void Render(HtmlTextWriter output) 
 {
   output.Write("Welcome to Control Development!<br>");

      // Test if the page is loaded for the first time
      if (!Page.IsPostBack)
          output.Write("Page has just been loaded");
     else
          output.Write("Postback has occurred");
 }
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")
   Else
      output.Write("Postback has occurred")
   End If
End Sub 

Remarks

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

Applies to

See also