How to fix alphabetic sorting of pages in EPiServer
Update: Do not try to change collation order in the database! Use this approach instead to sort pages in the page tree in EPiServer CMS 5.
I recently got the question how to fix the incorrect alphabetic sorting of child pages in EPiServer. It is usually Scandinavian users complaining that Å, Ä and Ö are sorted together with A and O instead of being at the end of the list.
Sort order: Alphabetical
When you specify the sort order of child pages your selection is stored in the database (tblPage.PeerOrderRule) and is shared for all language branches.
When you use GetChildren() it calls a stored procedure called netPageLinkList that returns the children ordered differently depending on the selection. Sorting is done in the database.
Easy Solution To Child Page Sort Order in EPiServer
1) Easiest way to fix sorting is to change the Collation order of the Name column in the tblPageLanguage table.
different sort order depending on the current culture
The easy solution only allows one common sort order for the entire database and that might not be good enough for multi lingual sites.
2) You can solve this for the whole site by hooking the event DataFactory.FinishedLoadingChildren and resorting the pages. Remember that this event is called every time you call GetChildren() and the result is not cached.
3) Another way is to solve it locally is to use the FilterSort class on you PageDataCollection or setting the SortOrder property on you PageList.