We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

String sorting behavior

Thread ID:

Created:

Updated:

Platform:

Replies:

88992 Aug 16,2009 03:27 PM UTC Aug 21,2009 12:14 PM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
Ron Rudman
Asked On August 16, 2009 03:27 PM UTC

Sorting a grid column of the following values: "cost", "comm", "coop", and "co-op" shows that the hyphen is being ignored. This is the designed behavior of String.Compare. What I need is the behavior of String.CompareOrdinal, which treats hyphen as just another character. How do I override the default behavior to accomplisth this?

Ideally, can I override this at a level that affects all string columns of all grids?

Rekha P [Syncfusion]
Replied On August 21, 2009 12:14 PM UTC

Hi Ron,

Thank you for your interest in Syncfusion Products.

Custom sorting enables you to implement custom sorting logic if the standard sorting techniques don't meet your requirements. You can add a custom IComparer to the GridSortColumnDescriptor for this column. You do this by setting the Comparer property on the GridSortColumnDescriptor. In your custom IComparer object, you can sort based on any criteria you choose including any color criteria on the record value.

The Comparer object allows you to control how the sorting is done on your column. Once the column is sorted, the custom Categorizer is used to determine which adjacent records in the sorted column belong to the same group. To create custom Comparer and Categorizer objects, you define classes that implement IComparer.

Refer the online sample below which portrays the custom sorting feature.

http://samples.syncfusion.com/ASPNET/7.3.0.20/web/Grid.Grouping.Web/samples/3.5/SortingandGrouping/BasicSorting/cs/customsorting.aspx

Please let me know if you have any concerns.

Thanks,
Rekha

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;