Vulnerability in EPiServer.Forms
Hello y'all! Is there a way to order as per tree structure view a PageDataCollection in version 6 of episerver?
If your're using DataFactory.Instance.GetChildren(), they should already be sorted just like the page tree. Which method are you using to retrieve all pages?
I'm pretty sure there are no built-in sorting for this, so you have to iterate all pages and check their parent's sorting rule and then sort them manually with the same rule.
Thanks Johan. I wasn't using GetChildren to get the collection of pages.
Apparently every PageData has a "PagePeerOrder" property retrievable by: PageDataItem["PagePeerOrder"]. I used that and it worked. It's the same index you see in the interface as you hover over a page item in the tree view.
Glad you found a solution to your problem. But please notice that the PagePeerOrder property is only valid if the parent has set its children sort orde rule to sort by index. If an editor changes the sort order rule to e.g. 'Published date ascending' you can't use PagePeerOrder.