Class PageTemplateContainer
Used for template context on a page level.
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.dll
Version: 9.12.2Syntax
public class PageTemplateContainer : Control, INamingContainer, IPageSource, IContentSource
Constructors
PageTemplateContainer(PageData)
Initializes a new instance of the PageTemplateContainer class.
Declaration
public PageTemplateContainer(PageData page)
Parameters
Type | Name | Description |
---|---|---|
PageData | page | The page. |
PageTemplateContainer(PageData, Int32, Boolean)
Initializes a new instance of the PageTemplateContainer class specifying an indent and whether the provided page has children to render.
Declaration
public PageTemplateContainer(PageData page, int indent, bool hasChildren)
Parameters
Type | Name | Description |
---|---|---|
PageData | page | Page to host |
System.Int32 | indent | The indent. |
System.Boolean | hasChildren | if set to |
PageTemplateContainer(PageData, Int32, Boolean, IPageSource)
Initializes a new instance of the PageTemplateContainer class specifying an indent and whether the provided page has children to render.
Declaration
public PageTemplateContainer(PageData page, int indent, bool hasChildren, IPageSource pageSource)
Parameters
Type | Name | Description |
---|---|---|
PageData | page | The page. |
System.Int32 | indent | The indent. |
System.Boolean | hasChildren | Specifies whether 'page' has children or not. |
IPageSource | pageSource | The page source. |
Properties
CurrentContent
Gets the currently loaded IContent.
Declaration
public IContent CurrentContent { get; }
Property Value
Type | Description |
---|---|
IContent | Returns information about the currently loaded content, or a content in a collection when used inside a control. |
CurrentPage
Page that is being hosted by template
Declaration
public PageData CurrentPage { get; }
Property Value
Type | Description |
---|---|
PageData |
DataItem
To support same syntax as System.Web.UI.WebControls.Repeater and others the current page is also available through DataItem
Declaration
public object DataItem { get; }
Property Value
Type | Description |
---|---|
System.Object |
HasChildren
If the rendered/current page has any visible children in this context.
Declaration
public bool HasChildren { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This value will only be valid for a control that evaluate a tree structure such as PageTree.
Indent
Gets the current indent.
Declaration
public int Indent { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The current indent. |
PreviewText
Text representation of page.
Declaration
public string PreviewText { get; }
Property Value
Type | Description |
---|---|
System.String | Returns a String with preview of the page. |
Remarks
The preview text is determined by the following:
Methods
Get<T>(ContentReference)
Retrieves a IContent object with information about a content, based on the ContentReference parameter.
Declaration
public T Get<T>(ContentReference contentLink)
where T : IContentData
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | Reference to the content being retrieved |
Returns
Type | Description |
---|---|
T | IContent object requested |
Type Parameters
Name | Description |
---|---|
T |
GetChildren<T>(ContentReference)
Retrieve a IContent listing
Declaration
public IEnumerable<T> GetChildren<T>(ContentReference contentLink)
where T : IContentData
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | Reference to parent content |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Returns a collection of IContent directly below the content referenced by the ContentReference parameter. |
Type Parameters
Name | Description |
---|---|
T |
InstantiateWithFallback(ITemplate[])
Instantiates the template container in the first non null ITemplate references passed in the templateChain
Declaration
public bool InstantiateWithFallback(params ITemplate[] templateChain)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.ITemplate[] | templateChain | A chain of ITemplate objects |
Returns
Type | Description |
---|---|
System.Boolean |
Explicit Interface Implementations
IPageSource.GetChildren(PageReference)
Declaration
PageDataCollection IPageSource.GetChildren(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink |
Returns
Type | Description |
---|---|
PageDataCollection |
IPageSource.GetPage(PageReference)
Declaration
PageData IPageSource.GetPage(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink |
Returns
Type | Description |
---|---|
PageData |