This is a migrated thread and some comments may be shown as answers.

GridView Filters Case Sensitive

18 Answers 493 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 19 Dec 2011, 09:47 PM
I would like to turn off the case sensitive filters in the WinForm GridView.  I've found a few CaseSensitive flags and have set them to  false  but the grid filters are remaining case sensitive.  Here is an example of what I tried:

dataTable.Rows.Clear();
dataTable.BeginLoadData();
   ((logic for adding rows to the data table is here))
dataTable.CaseSensitive = false;
dataTable.EndLoadData();

radGridView.MasterTemplate.BeginUpdate();
radGridView.MasterTemplate.CaseSensitive = false;
radGridView.DataSource = dataTable;
radGridView.GridBehavior.GridControl.CaseSensitive = false;
radGridView.MasterTemplate.EndUpdate();

I am using the following Telerik library:
    WinForms Q3 2011 (version 2011.3.11.1116)

Can you please explain how to turn off case sensitivity for the filters in your WinForm grid control?

Can you also provide the class paths for all the CaseSensitivity flags?
  e.g. 1) radGridView.MasterTemplate.CaseSensitive
         2) radGridView.GridBehavior.GridControl.CaseSensitive
         3) etc...

Thanks so much!
Scott

18 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 21 Dec 2011, 12:18 PM
Hello Matt,

Thank you for writing.

The property that you need to work with in order to modify the case sensitivity of RadGridView is the CaseSensitive property of the desired template. So if you have only one level of data you can set this property of the control, alternatively you need to set it to every child template. Here is a sample code for flat grid, which will demonstrate how this property works. 
GridViewTextBoxColumn col = new GridViewTextBoxColumn();
radGridView1.Columns.Add(col);
col.Width = 200;
radGridView1.Rows.Add("Jim");
radGridView1.Rows.Add("jim");
 
radGridView1.EnableFiltering = true;
radGridView1.MasterTemplate.CaseSensitive = true;

I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.

All the best,
Stefan
the Telerik team

Q3’11
of RadControls for WinForms is available for download (see what's new). Get it today.
0
cevdet
Top achievements
Rank 1
answered on 24 Feb 2015, 08:57 AM
Hi Stefan,

I want to filter RadGrid InSensitive mode, how can I achieve this ?
Thank for future helps.
0
Stefan
Telerik team
answered on 25 Feb 2015, 08:20 AM
Hi Cevdet,

As I mentioned in my previous post, to enable case sensitive filtering of the grid, you need to set the CaseSensitive property:
radGridView1.MasterTemplate.CaseSensitive = true;

I hope this helps.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
cevdet
Top achievements
Rank 1
answered on 25 Feb 2015, 08:41 AM
Hi again,

I mean, It is not working when I try to filter turkish characters "ı,i,ö,ü,ş,ç,ğ,I,İ,Ö,Ü,Ş,Ç,Ğ" in RadGrid.
For exammple :
Record => Kitap,  Filter => İ  (İ is uppercase)
Record => KİTAP, Filter => i (i is lowercase)

Tnaks
0
cevdet
Top achievements
Rank 1
answered on 25 Feb 2015, 08:55 AM
If I change RadGrid CultureInfo, the problem will be solved ?
If so, how can I change CultureInfo of Radgrid ?
0
Stefan
Telerik team
answered on 26 Feb 2015, 01:15 PM
Hi Cevdet,

I have tested this with the examples you provided and seems to be working just fine on my end. Attached you can find a video (opens in browser) of the process.

The culture I have is en-US (Thread.CurrentThread.CurrentUICulture).

What is the culture you have?

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
cevdet
Top achievements
Rank 1
answered on 26 Feb 2015, 01:26 PM
Hi,

My culture is tr-TR,
How can I reach the video ?

Thanks for response.
0
Stefan
Telerik team
answered on 26 Feb 2015, 02:46 PM
Hi,

I have tested with "tr-TR" and I get the same behavior.

Let me try to attach the video once again to this post, as it seems it did not appear in the previous one.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Stefan
Telerik team
answered on 26 Feb 2015, 02:50 PM
It seems we currently have some issue with the attachments - already looking into it. 

I have uploaded the video here for you.
0
Cevdet
Top achievements
Rank 1
answered on 04 Mar 2015, 11:30 AM
Hi Stefan again,

I downloaded video but can't see clearly, please send me a piece of your code or whole demo project ?

Thanks.
0
Stefan
Telerik team
answered on 05 Mar 2015, 12:25 PM
Hello,

The project is what you can see on the video. I have attached it to this post for your convenience.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
cevdet
Top achievements
Rank 1
answered on 05 Mar 2015, 12:48 PM
Hi,

I run the project that you attached but I mean :
When I click filter1 or filter2 button, I want to see two record (Kitap and KİTAP) on RadGridView.

How can I do that ?
Thanks.
0
Stefan
Telerik team
answered on 06 Mar 2015, 02:24 PM
Hello,

Thank you for the clarification. 

The comparison we perform during the filtering uses InvariantCulture, hence it is culture-insensitive. What I can offer for your case is to use Custom Filtering. Here is a small example:
public partial class Form1 : Form
    {
        RadGridView radGridView1 = new RadGridView();
        CultureInfo cultureInfo = new CultureInfo("tr-TR");
 
        public Form1()
        {
            InitializeComponent();
 
            this.Controls.Add(radGridView1);
            radGridView1.Size = new System.Drawing.Size(300, 300);
 
            radGridView1.Columns.Add("column1");
            radGridView1.Columns[0].Width = 100;
            radGridView1.Rows.Add("Kitap");
            radGridView1.Rows.Add("KİTAP");
 
            radGridView1.EnableFiltering = true;
            radGridView1.EnableCustomFiltering = true;
            radGridView1.CustomFiltering += radGridView1_CustomFiltering;
        }
 
        void radGridView1_CustomFiltering(object sender, GridViewCustomFilteringEventArgs e)
        {
            if (radGridView1.FilterDescriptors.Count == 0)
            {
                return;
            }
 
            foreach (var item in radGridView1.FilterDescriptors)
            {
                string cellValue = e.Row.Cells[item.PropertyName].Value.ToString();
 
                if (item.Operator == Telerik.WinControls.Data.FilterOperator.Contains)
                {
                    e.Visible = cultureInfo.CompareInfo.IndexOf(cellValue, item.Value.ToString(), CompareOptions.IgnoreCase) > -1;
                }
            }
             
            if (e.Visible)
            {
                e.Handled = true;
            }
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            radGridView1.FilterDescriptors.Clear();
            radGridView1.FilterDescriptors.Add(new FilterDescriptor("column1", FilterOperator.Contains, "İ") { IsFilterEditor = true });
        }
    }

I hope that you find it useful.
 
Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
cevdet
Top achievements
Rank 1
answered on 06 Mar 2015, 03:17 PM
Thank you Stefan,
It worked fine for contains filter.
How can we change code for all filters (starts with, ends with, not contains, contains, etc...) ?

Thanks.
0
Stefan
Telerik team
answered on 06 Mar 2015, 03:36 PM
You will just have to extend the code I gave you with if statements for every operator you want:
if (item.Operator == Telerik.WinControls.Data.FilterOperator.X)
{
     //perform your custom filtering
}

I hope this helps.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
cevdet
Top achievements
Rank 1
answered on 06 Mar 2015, 05:02 PM
Ok Stefan thanks a lot.

Regards.
0
Claudio
Top achievements
Rank 1
answered on 20 Jul 2017, 12:30 PM

I try to use the filter of the column (radgridview ) but I want to digit filter in case sensitive.

In the example I wanto to enter "tg" with filter row with "tg- . .. " and not "TG-. . . . ."

 

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 21 Jul 2017, 07:52 AM
Hello Claudio, 

Thank you for writing.  

The property that you need to work with in order to modify the case sensitivity of RadGridView is the CaseSensitive property of the desired template. So if you have only one level of data you can set this property of the control, alternatively, you need to set it to every child template. Here is a sample code for the flat grid, which will demonstrate how this property works. 
this.radGridView1.MasterTemplate.CaseSensitive = true;

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Matt
Top achievements
Rank 1
Answers by
Stefan
Telerik team
cevdet
Top achievements
Rank 1
Cevdet
Top achievements
Rank 1
Claudio
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or