Should return references to all children of the specific page.

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

Syntax

C#
protected abstract PageReferenceCollection GetChildrenReferences(
	PageReference pageLink,
	string languageID
)

Parameters

pageLink
Type: EPiServer.Core..::.PageReference
The page link.
languageID
Type: System..::.String
The language ID.

Return Value

Reference to all children

Remarks

This is expected to return all children regardless of languages. Parameter languageID (if given) can be used to sort on language occurance.

Examples

The following code sample is an implementation of GetChildrenReferences() for XmlPageProvider.
CopyC#
protected override PageReferenceCollection GetChildrenReferences(PageReference pageLink, string languageID)
{
    // 
    //children to entrypoint is stored with parent=0 in xml file (to avoid hard coupling to entrypoint)
    // 
    int parentId = pageLink != EntryPoint ? pageLink.ID : 0;
    PageReferenceCollection children = new PageReferenceCollection();
    var query = from page in XmlPages.Descendants("page")
                where String.Equals(page.Attribute("parent").Value, parentId.ToString())
                select Int32.Parse(page.Attribute("id").Value);

    IEnumerator<int> enumerator = query.GetEnumerator();
    while (enumerator.MoveNext())
    {
        //We make sure we only return unique PageReferences
        PageReference pageRef = ConstructPageReference(enumerator.Current);
        if (!children.Contains(pageRef))
        {
            //we dont want to add a reference for all languages
            children.Add(pageRef);
        }
    }
    return children;
}

See Also