Filter data with double quotes

9 posts, 0 answers
  1. Nikolay
    Nikolay avatar
    8 posts
    Member since:
    Jan 2009

    Posted 15 Jan 2009 Link to this post

    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. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 15 Jan 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nikolay
    Nikolay avatar
    8 posts
    Member since:
    Jan 2009

    Posted 15 Jan 2009 Link to this post

    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!
  5. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 19 Jan 2009 Link to this post

    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.
  6. Amit
    Amit avatar
    14 posts
    Member since:
    Apr 2009

    Posted 02 Nov 2009 Link to this post

    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.





  7. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 04 Nov 2009 Link to this post

    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.
  8. Marie
    Marie avatar
    9 posts
    Member since:
    May 2014

    Posted 18 Nov 2014 in reply to Daniel Link to this post

    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 + " ')";
  9. Marie
    Marie avatar
    9 posts
    Member since:
    May 2014

    Posted 18 Nov 2014 in reply to Marie Link to this post

    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 + "')";
  10. Surbhi
    Surbhi avatar
    1 posts
    Member since:
    May 2015

    Posted 28 May 2015 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017