Gets a reference to the Page instance that contains the server control.
Assembly: System.Web (in System.Web.dll)
Syntax
<[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_0_0_0%](False)> _
<[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_0_0_1%](False)> _
Public Overridable Property Page As [%$TOPIC/0abwwyk7_en-us_VS_110_2_0_0_0_2%]
[[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_1_0_0%](false)]
[[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_1_0_1%](false)]
public virtual [%$TOPIC/0abwwyk7_en-us_VS_110_2_0_1_0_2%] Page { get; set; }
[[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_2_0_0%](false)]
[[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_2_0_1%](false)]
public:
virtual property [%$TOPIC/0abwwyk7_en-us_VS_110_2_0_2_0_2%]^ Page {
[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_2_0_3%]^ get ();
void set ([%$TOPIC/0abwwyk7_en-us_VS_110_2_0_2_0_4%]^ value);
}
[<[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_3_0_0%](false)>]
[<[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_3_0_1%](false)>]
abstract Page : [%$TOPIC/0abwwyk7_en-us_VS_110_2_0_3_0_2%] with get, set
[<[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_3_0_3%](false)>]
[<[%$TOPIC/0abwwyk7_en-us_VS_110_2_0_3_0_4%](false)>]
override Page : [%$TOPIC/0abwwyk7_en-us_VS_110_2_0_3_0_5%] with get, set
Exceptions
| Exception | Condition |
|---|---|
| InvalidOperationException | The control is a Substitution control. |
Examples
The following example overrides the ControlRender method. It uses the Page property to access the PageIsPostBack 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")
Else
output.Write("Postback has occured")
End If
End Sub
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 occured");
}
Platforms
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.