November Happy Hour will be moved to Thursday December 5th.

Sorting a page collection

Vote:
 
Hi, I have a collection of pages and wants it be sorted by the "Title" property. For some reason my sorting is not working. The order is always the same. FilterPropertySort sorter; sorter = new FilterPropertySort("Title",FilterSortDirection.Descending); pageCol.Sort(sorter); Thanks ! Danie
#12608
Apr 25, 2006 17:36
Vote:
 
I've never used, or actually seen, the Sort method on the PageDataCollection class, and without having testet it, I guess there is something wrong with it, or perhaps the filter. The code looks good, and is the way I'd do it, if I had known about that Sort method :-) This is how I usually solve it: FilterPropertySort sorter; sorter = new FilterPropertySort("Title", FilterSortDirection.Descending); // The filter method need the pagedata collection FilterEventArgs eArgs = new FilterEventArgs(pageCol); // Sort it sorter.Filter(this, eArgs); // the pageCol is now sorted It does not look as good as your code, but it should work. /Steve
#14582
Apr 25, 2006 20:59
Vote:
 
Hi, thanks for your help! I've tried your code, but got the same results. BUT (My mistake!) I've used that page collection as a DataSource for a NewsList control and didn't realize that it sort using the Publishing date by default. So after specifying to what the newslist should sort to (Title), everything seems to work fine now. Thanks ! Danie
#14583
Apr 26, 2006 8:39
Vote:
 
Just shows us that we can learn from mistakes. You've learned about the built-in sorting feature of the pagelist control, and I have learned a better way to sort a PageDataCollection. :-) /Steve
#14584
Apr 26, 2006 9:41
* 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.