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

Filter data with double quotes

2 Answers 519 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nikolay
Top achievements
Rank 1
Nikolay asked on 15 Jan 2009, 09:28 AM
Hi!

I have issue with filter radGrid, when data in filter field contains double quotes ("). For example: <"Telerik" company>. In this case there is no filter action, and filter field cleaning after pressing on filter button.
This issue exist in online filter demo: http://demos.telerik.com/aspnet-ajax/Grid/Examples/GeneralFeatures/Filtering/DefaultCS.aspx
Try type in filter field some text with double quote and apply filter action. No filter will be apply and filter field will be clear.
There is workaround or fix for this issue?
Thank you.

P.S. Sorry for my English.


2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 15 Jan 2009, 09:54 AM
Hello Nikolay,

Please note that filtering with quotes ( " ) is not supported for our RadGrid control. 

Excuse us for any inconvenience caused.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Nikolay
Top achievements
Rank 1
commented on 15 Jan 2009, 10:09 AM

Hello!

There is no plans for adding this functional in new versions of RadGrid?
It is strange restriction. There is many case when data contains quotes (for example, customers names), and user need to filter this data.
Thank you very much!
Daniel
Telerik team
commented on 19 Jan 2009, 06:47 PM

Hello Nikolay,

Thank you for your feedback.

I would like to inform you that we don't have many similar requests so far. Nevertheless I added your suggestion in our product backlog for future consideration by our developers.

Please let us know if you need further assistance.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Amit
Top achievements
Rank 1
commented on 02 Nov 2009, 06:15 AM

Hi Daniel,

Are you sure double quotes as mentioned below are not supported in rad grid, because they work perfectly for me :-).

But problem is there with single quotes.Root cause of this is when comparing the values in filters we put value in single quotes:
([<column value>] like '% <Filter value> %')

This is done while setting FilterExpression property.
Is there a way so that we can use any encoding technique within C# code while setting this property.





Daniel
Telerik team
commented on 04 Nov 2009, 02:37 PM

Hello Amit,

Single quotes should be escaped with another single quote:
RadGrid1.MasterTableView.FilterExpression = "([asdf] like '%''3%')";

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Marie
Top achievements
Rank 1
commented on 18 Nov 2014, 07:53 PM

I was having the same problem with single quotes...

I tried to replace ' by \' but nothing, the filter is not filtering, and no error... simply not filtering
if (value.Contains(" ' "))
    value = value.Replace(" ' ", " \' ");
filterExpression = "([brand2_itg] = ' " + value + " ')";
Marie
Top achievements
Rank 1
commented on 18 Nov 2014, 08:13 PM

I get it!
We replace the  single quote by two single quotes, and that's all!

if (value.Contains("'")) // If value contiens a single quote
                        value = value.Replace("'", "''"); // replace the single quote by TWO single quotes, not a double quote
                    filterExpression = "([columnToFilter] = '" + value + "')";
Surbhi
Top achievements
Rank 1
commented on 28 May 2015, 01:25 PM

For me RadGrid.MasterTableView.FilterExpression is not detecting values with "" (e.g. "cow"). I tried adding GridFilterFunction.IllegalStrings = new string[] { " LIKE ", " AND ", " OR ", " NULL ", " IS " }; in my page_load event, now FilterExpression detects " but like ""cow"" and hence throws an exception. I even tried splitting extra " but that's not working out. Please help me with this. Thanks in advance.
S
Top achievements
Rank 1
commented on 14 Dec 2023, 07:34 AM

Is the double quote still not supported?
0
Vasko
Telerik team
answered on 18 Dec 2023, 08:41 AM | edited on 18 Dec 2023, 12:45 PM

Hello,

By default, the double quotes are considered illegal characters, and the Grid will ignore this upon filtering, thus improving the security. If you would like to override that, you can do so by modifying the IllegalStrings property. For more details, you can check out the Filter RadGrid with quotes, AND, OR, or other special symbols article.

Please note that all illegal characters in the collection will remain as is, meaning that double quotes will remain unsupported.

Kind regards,
Vasko
Progress Telerik

S
Top achievements
Rank 1
commented on 18 Dec 2023, 12:50 PM | edited

Vasko,

Thanks for the detail.  We will try this fix and let you know.

Regards,

Sivajothi R.

Tags
Grid
Asked by
Nikolay
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Vasko
Telerik team
Share this question
or