A blog about understanding and extending Episerver. May contain traces of posts not concerning Episerver.
Sort a pagedatacollection via property
new FilterPropertySort(“PageName”, FilterSortDirection.Descending).Filter(children);
9 thoughts on “Sort a pagedatacollection via property”
Arun
Dear Erik,
Using the above said method i got a PageDatacollection is sorted order (sorted with PageName Property). But in the sorted PDC i need to apply another sort Using Pagename. Suppose if Page Name/PageID is in This collection A/12,B/11,C/13,A/14,B/15,C/16…..Now
new FilterPropertySort(“PageName”, FilterSortDirection.Descending).Filter(children); Will give me a result like A/14,A/12,B/15,B/11,C/16,C/13.
Rather I need like A/12,A/14,B/11,B/15,C/13,C/16… Plz help me to resolve this Problem…
Hmm, you could try to first sort by PageLink and then by PageName.
If that doesn’t work I guess you have to write your own Comparer which first checks the PageName, if they are equal then check the PageLink ID.
Dear Erik,
Using the above said method i got a PageDatacollection is sorted order (sorted with PageName Property). But in the sorted PDC i need to apply another sort Using Pagename. Suppose if Page Name/PageID is in This collection A/12,B/11,C/13,A/14,B/15,C/16…..Now
new FilterPropertySort(“PageName”, FilterSortDirection.Descending).Filter(children); Will give me a result like A/14,A/12,B/15,B/11,C/16,C/13.
Rather I need like A/12,A/14,B/11,B/15,C/13,C/16… Plz help me to resolve this Problem…
Hmm, you could try to first sort by PageLink and then by PageName.
If that doesn’t work I guess you have to write your own Comparer which first checks the PageName, if they are equal then check the PageLink ID.
Good luck.
Great tip.
This post just saved me hours!
Thanks.