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?
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?
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">
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.
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,