Try our conversational search powered by Generative AI!

Sorting a PageDataCollection according to the PageChildOrderRule

Vote:
 
Hi. We want to sort a PageDataCollection according to the value of the PageChildOrderRule property. It works fine on the PageName property, but not on anything else. Do anyone know what I need to do here? CODE: FilterSortOrder filter = (FilterSortOrder)CurrentPage.Property["PageChildOrderRule"].Value; FilterPropertySort sorter; FilterEventArgs eArgs = new FilterEventArgs(children); switch (filter.ToString()) { case ("Alphabetical"): sorter = new FilterPropertySort("PageName" , (FilterSortDirection.Ascending)); sorter.Filter(this, eArgs); break; case ("CreatedDescending"): sorter = new FilterPropertySort("Created", (FilterSortDirection.Descending)); sorter.Filter(this, eArgs); break; case ("CreatedAscending"): sorter = new FilterPropertySort("Created", (FilterSortDirection.Ascending)); sorter.Filter(this, eArgs); break; case ("ChangedDescending"): sorter = new FilterPropertySort("Changed", (FilterSortDirection.Descending)); sorter.Filter(this, eArgs); break; case ("Rank"): sorter = new FilterPropertySort("Created", (FilterSortDirection.Ascending)); sorter.Filter(this, eArgs); break; case ("PublishedAscending"): sorter = new FilterPropertySort("StartPublish", (FilterSortDirection.Ascending)); sorter.Filter(this, eArgs); break; case ("PublishedDescending"): sorter = new FilterPropertySort("StartPublish", (FilterSortDirection.Descending)); sorter.Filter(this, eArgs); break; default: break; }
#12993
Apr 03, 2007 14:41
Vote:
 
Hi I think the problem is that when accessing the properties programmatically you need to add the prefix "Page". So, instead of "Created" use "PageCreated", instead of "StartPublish" use "PageStartPublish", and so on... That's why only sorting by PageName work.
#15220
Apr 03, 2007 17:12
Vote:
 
You can see all the property names in the EPiServer SDK under "Properties."
#15221
Apr 03, 2007 23:00
Vote:
 
Use the filters in EPiServer.Filter namespace instead. /HAXEN
#15222
Apr 04, 2007 10:11
Vote:
 
Thanks guys. Works great now :) BR, Tore
#15223
Apr 04, 2007 10:42
* 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.