Try our conversational search powered by Generative AI!

child pages




I need to display content in boxes from children pages. The pages I want to collect data from are children of child pages... how would I access pages farther down in the node tree than immediate children?



Jul 01, 2009 12:38

I would use FindPagesWithCriteria. Something like this:

var criterias = new PropertyCriteriaCollection();
            var pubCriteria = new PropertyCriteria();
            pubCriteria.Condition = CompareCondition.Equal;
            pubCriteria.Name = "PagePendingPublish";
            pubCriteria.Type = PropertyDataType.Boolean;
            pubCriteria.Value = false.ToString();

PageDataCollection matches = Global.EPDataFactory.FindPagesWithCriteria(CurrentPage.PageLink, criterias);

Hope it helps.



Jul 01, 2009 12:59

this helps a great deal... I have a place to start for sure.


would I add the boolean property "PagePendingPublish" to each child page I wish to publish?




Jul 01, 2009 13:27
Or if you are using CMS 5 you can use

PageDataCollection pageColl = DataFactory.Instance.GetDescendents(yourStartingPage.PageLink);

 Then you can filter the result afterwards if you want to.



Jul 01, 2009 13:28


If you are using CMS 5 and above, you can use nested foreach loops to get down to the child of child pages. First loop go over the children, nested one go over the children of children.


here is a sample code


  //get the page reference to start page
         PageReference productStartPage =   CurrentPage.Property["ProductStartPage"].Value as PageReference;

            //get the children
            PageDataCollection products = GetChildren(productStartPage);
        //loop through children   
            foreach (PageData product in products)
              //get page reference to that chidren page   
              PageReference currentProduct = product.PageLink
        //get child pages for the current children page or grandchildren of start page
               PageDataCollection childproducts = GetChildren(currentProduct);

            //loop through them
                        foreach (PageData child in childproducts)
                            //find the relvant product
                            if (child.PageName == ProductDropDownList.SelectedItem.Value)
                    //do somthing


Edited, Jul 24, 2009 1:17
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.