Retrieves a PageData listing based on supplied PageReference argument (from IPageSource).

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

Syntax

C#
public virtual PageDataCollection GetChildren(
	PageReference pageLink
)

Parameters

pageLink
Type: EPiServer.Core..::.PageReference

Return Value

Implements

IPageSource..::.GetChildren(PageReference)

Remarks

The IPageSource interface is implemented by many classes, such as PageBase (and its descendants), DataFactory, PageControlBase. You typically use the members of this interface to get information about the current page (the CurrentPage property) or use either the GetPage or GetChildren methods to retrieve page data.

IPageSource was created as an interface due to the fact that the GetPage and GetChildren methods normally have the same implementation independently of the class that implements IPageSource. The CurrentPage property has different meanings for different implementations. As an example, CurrentPage on the PageBase class refers to the currently loaded page (based on the ID in the query string).

Note: Note: As IPageSource is an interface, it doesn't implement any of its own attributes or methods itself. This means that you must be aware of which class implementing IPageSource that you're dealing with. For example, PageBase.CurrentPage returns a PageData object for the current page, the same for UserControlBase. However, in a templated control such as EPiServer.Web.WebControls.PageList, CurrentPage instead means the current page in the iteration.

Examples

The following code example demonstrates a specialized implementation of IPageSource to set custom access level restrictions to the pages returned.
CopyC#
public class RestrictedPageSource : IPageSource
{
    AccessLevel RequiredLevel;

    public RestrictedPageSource()
    : this(AccessLevel.Read)
    {
    }

    public RestrictedPageSource(AccessLevel requiredLevel)
    {
        RequiredLevel = requiredLevel;
    }

    public PageData GetPage(PageReference pageLink)
    {
        return DataFactory.Instance.GetPage(pageLink);
    }

    public PageDataCollection GetChildren(PageReference pageLink)
    {
        return DataFactory.Instance.GetChildren(pageLink);
    }

    public PageData CurrentPage
    {
        get { return null; }
    }
}

See Also