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

Filter data with double quotes

8 Answers 169 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.


8 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.
0
Nikolay
Top achievements
Rank 1
answered 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!
0
Daniel
Telerik team
answered 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.
0
Amit
Top achievements
Rank 1
answered 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.





0
Daniel
Telerik team
answered 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.
0
Marie
Top achievements
Rank 1
answered 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 + " ')";
0
Marie
Top achievements
Rank 1
answered 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 + "')";
0
Surbhi
Top achievements
Rank 1
answered 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.
Tags
Grid
Asked by
Nikolay
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Nikolay
Top achievements
Rank 1
Amit
Top achievements
Rank 1
Marie
Top achievements
Rank 1
Surbhi
Top achievements
Rank 1
Share this question
or