Control.Page Property
.NET Framework 2.0
Gets a reference to the Page instance that contains the server control.
Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
[BindableAttribute(false)] public: virtual property Page^ Page { Page^ get (); void set (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 type | Condition |
|---|---|
|
The control is a Substitution 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 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
Community Additions
ADD
Show: