Page class derives from TemplateControl
class;
public class Page : TemplateControl, IHttpHandler
and TemplateControl
class derives from abstract Control
class;
public abstract class TemplateControl : Control, ...
In Control
class which Page
class derives from there is a virtual property named as Page;
// Summary:
// Gets a reference to the System.Web.UI.Page instance that contains the server
// control.
//
public virtual Page Page { get; set; }
In the Page
class there are properties like IsPostBack
, IsValid
etc;
// Summary:
// Gets a value that indicates whether the page is being rendered for the first
// time or is being loaded in response to a postback.
//
public bool IsPostBack { get; }
Thus,
Since the aspx page derives from Page
class, it also inherits TemplateControl
and Control
classes. In Control
class there is a public property named as Page
thus you can access Page
property in your class. And Page
class has public properties like IsPostback
and IsValid
etc., so you can use these properties from Page
property.
public class Test : Page
{
public Test()
{
bool test = this.IsCallback;
}
}