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

Disable Case Sensitive sorting

Thread ID:

Created:

Updated:

Platform:

Replies:

132070 Aug 11,2017 12:45 AM UTC Aug 11,2017 01:43 PM UTC WinForms 1
loading
Tags: GridGroupingControl
Meetu Thomas
Asked On August 11, 2017 12:45 AM UTC

Hi,

My example has the grid grouping control populated with customer details(CustomerId, FirstName, FamilyName, Phone, Email).
If i try to sort the grid by FamilyName and FirstName, i get the result as a case sensitive sort as below

CustomerId FirstName FamilyName Phone Email
4 Alex Brown 4541234 qwq@ww.com
1 Brian Brown 3423232 wwe@wewe.com
3 Amber BROWN 4345656 tyty@tyt.ac.df
2Asmin
BROWN4587527tytryt@rtr.cvcb

Expected Result
CustomerIdFirstNameFamilyNamePhoneEmail
4AlexBrown4541234qwq@ww.com
2Amber
BROWN
4345656
tyty@tyt.ac.df
3Asmin
BROWN
4587527
tytryt@rtr.cvcb
1Brian
Brown3423232
wwe@yhu.com

How can i disable the case sensitive sort. Any help is highly appreciated.

Thanks

Arulpriya Ramalingam [Syncfusion]
Replied On August 11, 2017 01:43 PM UTC

Hi Meetu, 
 
Thanks for using Syncfusion products. 
 
In order to sort the records with case insensitive, the CustomSortComparer can be implemented from IComparer interface and the Compare() method can be customized to sort the records with case insensitive. The TableControlCellClick event can be used to add the CustomSortComparer at run time. We have modified the sample as per your requirement. Please make use of below code and sample, 
 
Code snippet 
 
SortColumnDescriptor cd; 
#region CustomSort 
public class CustomSortComparer : IComparer 
{ 
    public CustomSort() 
    { 
    } 
    public int Compare(object x, object y) 
    { 
        if (x == null && y == null) 
        { 
            return 0; 
        } 
        else 
        { 
            //To avoid the Case sensitive 
            return ((IComparable)x.ToString().ToLower()).CompareTo(y.ToString().ToLower()); 
        } 
    } 
} 
#endregion 
 
 
 
Regards, 
Arulpriya 


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

;