Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Episerver 6, how to find all child pages id's of a page on an different page?
Posted

1 solution

Hi,

By using the the method GetDescendents() you will get the details of all subpages or say child pages. and you can the required attributes or id whatever you want to use.

Example:
C#
 public static List<T> GetDescendentsOfType<T>(this DataFactory dataFactory, PageReference pageLink)
        {
            var listOfPages = dataFactory.GetDescendents(pageLink);
            var pageData = new PageDataCollection();
            foreach (var reference in listOfPages)
            {
                var page = dataFactory.GetPage(reference);
// Here you can access the id of sub pages
var id=page.PageTypeId;<b></b>
                if (page is T)
                    pageData.Add(page);
            }
            return pageData.Cast<T>().ToList();
        }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900