Try our conversational search powered by Generative AI!

How to Order PageDataCollection using a bespoke property



I am trying to Sort the order of a PageDataCollection but it is not working.

I am using the following code whare EventPriority is an Int.

PageDataCollection pages = DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage, criterias);

            // Sort the results first
            FilterPropertySort sorter = new FilterPropertySort("EventPriority", (FilterSortDirection.Ascending));

But it does not work - can anyone help?

Edited, Aug 15, 2016 15:19

That code looks good to me. How are you using the pages after they have been sorted? Have you debugged your code and stopped just after they have been sorted, to see if it actually worked?

Aug 15, 2016 18:22


We can't debug the site locally - it's funny - we have worked with Episerver for over 4 years and we have never been able to run it locally.

We just bind pages to the News List:

News.DataSource = pages;
<EPiServer:NewsList runat="server" ID="News">
Aug 15, 2016 18:25

And you're not using the sort property on the newslist webcontrol? Because that will re-sort the collection.

What happens if you change to a pagelist webcontrol instead? There might be some kind of default sorting going on in the newslist webcontrol.

Aug 15, 2016 18:31

It's an odd one but I found a way to combat this issue - I have added the Sortby and SortDirection to the front end and this works.

<EPiServer:NewsList runat="server" ID="News" SortBy="EventPriority" SortDirection="Ascending">

Thanks for all your help,


Aug 16, 2016 13:27
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.