static CMS.Page LoadChildItem(CMS.Page parentItem) { CMS.Page result = null; foreach (CMS.Page item in unSortedPages) { result = null; if (item.ParentID == parentItem.PageID) { result = item; item.Level = parentItem.Level + 1; sortedPages.Add(result); LoadChildItem(result); } } return(result); }
public static CMS.PageCollection GetHierarchicalPageCollection(int parentID) { sortedPages = new PageCollection(); unSortedPages = new PageCollection().Load(); foreach (CMS.Page item in unSortedPages) { if (item.ParentID == parentID) { item.Level = 0; //check the role for validity sortedPages.Add(item); LoadChildItem(item); } } return(sortedPages); }
/// <summary> /// Loads up a Page Collection in hierarchical fashion with each level of the tree /// specified by the "Level" field. /// </summary> /// <returns></returns> public static CMS.PageCollection GetHierarchicalPageCollection() { sortedPages = new PageCollection(); unSortedPages = new PageCollection().Load(); foreach (CMS.Page item in unSortedPages) { if (item.ParentID == null) { item.Level = 0; //check the role for validity sortedPages.Add(item); LoadChildItem(item); } } return sortedPages; }