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
Mar 25, 2008 18:35
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
Mar 25, 2008 18:46
Vote:
 
You can see all the property names in the EPiServer SDK under "Properties."
#15221
Mar 25, 2008 18:46
Vote:
 
Use the filters in EPiServer.Filter namespace instead. /HAXEN
#15222
Mar 25, 2008 18:46
Vote:
 
Thanks guys. Works great now :) BR, Tore
#15223
Mar 25, 2008 18:46
* 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.