Display Pages of tree

web dev asked on May 28, 2020 20:21

Hello Kentico dev i want to display the content three in my page per this description

Page1

Page2

  child1

      child1-1

       child1-2
  child2

i tried to this multiple query but didnt work and the path start from /

DocumentHelper.GetDocuments()
                        .Type("cms.page", q => q.Columns("DocumentName", "NodeAliasPath"))
                        .Type("cms.news", q => q.Columns("DocumentName", "NodeAliasPath")
                         .Type("cms.children", q => q.Columns("DocumentName", "NodeAliasPath"))



                        .Path(path, PathTypeEnum.Children)
                        .OrderBy("NodeLevel, NodeOrder")
                        .OnSite("dancinggoat")
                        .Culture("en-us")
                        .OrderBy("NodeLevel, NodeOrder, DocumentName")
                        .ToList()
                        .Select(x => new SiteMapViewModel
                        {
                            DocumentName = x.DocumentName,
                            NodeAliasPath = x.NodeAliasPath,
                            //ChildrenCount = x.Children.Count

                        })

                        but didn't work

Recent Answers


Eric Dugre answered on May 29, 2020 00:29

Hello Nadia,

To display hierarchical data (e.g. the content tree exactly as it appears in the admin), you can use the example in this article: https://devnet.kentico.com/articles/displaying-the-content-tree-programmatically

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.