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
Mar 25, 2008 18:35
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
Mar 25, 2008 18:45
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
Mar 25, 2008 18:45
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
Mar 25, 2008 18:45
* 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.