Page attributes in ASP.NET for extending System.Web.UI.Page

PageBaseType – Takes a string value defining the base type that will be used for the bage. The default is System.Web.UI.Page. The value gets overridden by the value in the inherits attribute in the standalone file.

userControlbaseType – specifies the base type for controls to be used when the page is standalone.

After implementing classes that extend System.Web.UI.Page or System.Web.UI.UserControl their type can be determined for all pages in the site by their page attributes in web.config. Another way to define the type of the base class is by explicitly defined property CodeFileBaseClass=... in the Page or Control tag (first row in the page).

The using of Page properties (fields) or custom methods by user control is possible by converting Page field to the base page type:

CType(Me.Page, PageBase).Property
CType(Me.Page, PageBase).Method()

No comments:

Post a Comment