Currently loaded page on templates

Namespace:  EPiServer.Core
Assembly:  EPiServer (in EPiServer.dll) Version: 5.2.375.236

Syntax

C#
PageData CurrentPage { get; }

Field Value

Returns information about the currently loaded page, or a page in a collection when used inside a control.

Remarks

The implementation of CurrentPage is strictly up to the implementing class. Some of the templated Web controls implement IPageSource, and CurrentPage will typically refer to the current page being iterated in a collection or an array.

Another implementor is the PageBase class (you'll often use TemplatePage which inherits from PageBase). CurrentPage in the context of PageBase refers to the currently displayed page (as noted by the querystring ID).

CurrentPage may be null on sources that aren't connected through PageBase.

Examples

The following code example demonstrates the usage of CurrentPage.
CopyC#
Response.Write(CurrentPage.PageName);

See Also