Unable to sort using the SortedBindingList

Unable to sort using the SortedBindingList

Old forum URL: forums.lhotka.net/forums/t/2028.aspx


Rajat posted on Tuesday, December 26, 2006

I have a collection class derived from BusinessListBase<> named ABC. Now I want to sort the objects inside this class on the basis of various fields. For this I have created a sortedbindinglist...

SortedBindingList<class> sortedABC = new SortedBindingList<class>(ABC);

sortedABC.ApplySort("Date", ListSortDirection.Descending);

But I don't get the sorted data in sortedABC after calling ApplySort. What could be the problem here?

Regards,

Rajat.

 

William replied on Tuesday, December 26, 2006

If the "Date" property returns String instead of DateTime, it might cause the binary sorting mechanism to sort the data by ASCII order.
 
Regards,
William

Rajat replied on Wednesday, December 27, 2006

Hello,

Thanks for the reply.

I rechecked and "Date" property is of type "DateTime". I also tried with a different field called - "Quantity" which is of type "long". I am unable to sort on this new field as well.

Regards,

Rajat.

 

Copyright (c) Marimer LLC