Implement Insensitive Diacritic Filtering for RadGrid

Thread is closed for posting
7 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 21 Oct 2015 Link to this post

    Requirements

    Telerik Product and Version

    3.5+

    Supported Browsers and Platforms

    FF - current and previous
    Chrome - current and previous
    IE8+

    Programming language

    JavaScript, C#

    PROJECT DESCRIPTION 
    It is a common requirement to operate in various localization environments when building a web application. You may have multiple records in your database with values coming from different culture background. Widespread languages such as Spanish, German, French make extensive use of letters with diacritic marks, which leads to inconvenient searching experience for any user with limited access to these type of signs. This sample demonstrates how to overcome this limitation by rendering the filtering process insensitive to these letters. You can enhance it by adding your own symbols within the diacritics array inside the DiacriticInsensitiveColumn.cs class:

    string[] diacritics = new string[] {
        "aâãäàá",
        "eêëèé",
        "iîïìí",
        "oôõöòó",
        "uûüùú",
        "yý",
        "nñ",
        "cç"
    };

    The available filter functions are Contains, StartsWith, EndsWith, EqualTo. If necessary, the custom class can be further modified to support other functions as well.

  2. C722EFC1-7E58-4254-8B7C-49AB04B2CF77
    C722EFC1-7E58-4254-8B7C-49AB04B2CF77 avatar
    47 posts
    Member since:
    Sep 2005

    Posted 30 Oct 2019 in reply to 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD Link to this post

    Hi!

    I tried this project. I noticed that if I type more than, for instance, 10 characters, the "w3wp.exe" process crashes with a 'System.StackOverflowException'.  

    Any clues why this is happening?

    Thanks

  3. Matthew Tippett
    Matthew Tippett avatar
    3 posts
    Member since:
    Oct 2018

    Posted 30 Oct 2019 Link to this post

    Hello,

     

    I reached out to my technical team and they advised to please submit a support ticket or forum post as this is the best place for support

     

    Best,

    Matt

  4. Matthew Tippett
    Matthew Tippett avatar
    3 posts
    Member since:
    Oct 2018

    Posted 30 Oct 2019 in reply to C722EFC1-7E58-4254-8B7C-49AB04B2CF77 Link to this post

    Hello,

    I reached out to my technical team and they advised to please submit a support ticket or forum post as this is the best place for support

    Best,
    Matt
  5. 4513861F-C564-42D2-BC9F-5FAED19E993E
    4513861F-C564-42D2-BC9F-5FAED19E993E avatar
    4090 posts
    Member since:
    Apr 2022

    Posted 04 Nov 2019 Link to this post

    Hi Regula,

     

    Sorry for not removing this sample earlier. This was an experimental attempt to achieve this scenario but it turned out that it is not possible. And this sample should have been removed long ago.

    I am afraid diacritic accent-insensitive filtering for the grid is not supported. So if you have 2 or multiple different symbols for the same logical letter, this requirement won't be possible to achieve with the built-in filtering of the grid. For comparison, the combo uses a client-side JavaScipt filtering implementation so the source code can be overriden and altered to achieve this requirement:
    https://www.telerik.com/support/kb/aspnet-ajax/combobox/details/combobox-filtering-with-diacritic-accents

    However, I am afraid this is not possible for the grid since it uses code-behind internal filtering queries on the server-side. 

    As a workaround, you can try applying your own custom filtering:

    https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/Filtering/operate-with-the-filterexpression-manually

    Basically, you can filter the datasource manually using the values defined by the users and pass the resulting data to the grid in its NeedDataSource event handler. There is a handy COLLATE operator in the SQL arsenal for this kind of scenarios:
    https://stackoverflow.com/questions/2461522/how-do-i-perform-an-accent-insensitive-compare-e-with-%C3%A8-%C3%A9-%C3%AA-and-%C3%AB-in-sql-ser

    Another approach would be to add a new string field in your data source to hold "clean" values without any diacritics. Then, you can create a GridTemplateColumn with its DataField property set to "CleanField". In its ItemTemplate you can place a Label and set its Text to '<%# Eval("DiacriticsField") %>'.

    Alternatively, you can create 2 columns and filter by the second column instead, which will be hidden, similar to the attached web site sample.

    Also, I've updated your Telerik points for any inconvenience this might have caused you.

     

    Regards,
    Eyup
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  6. FAADCA78-16EE-408D-B7BF-6E9CE0008570
    FAADCA78-16EE-408D-B7BF-6E9CE0008570 avatar
    17 posts
    Member since:
    Mar 2011

    Posted 17 Sep 2020 in reply to C722EFC1-7E58-4254-8B7C-49AB04B2CF77 Link to this post

    Me too: System.StackOverflowException. 

    Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7a5f8
    Fault module name: System.Core.ni.dll, version: 4.8.3928.0, time stamp: 0x5d39014b
    Exception code: 0xc00000fd
    Failed offset: 0x002054d4
    Failed process ID: 0x4694
    Failed application start time: 0x01d68d4aa5fc9a09
    Faulting application path: C: \ Windows \ SysWOW64 \ inetsrv \ w3wp.exe
    Failure module path: C: \ Windows \ assembly \ NativeImages_v4.0.30319_32 \ System.Core \ 31fae3290fad30c31c98651462d22724 \ System.Core.ni.dll
    Report ID: f423a9f5-f940-11ea-a722-082e5f82e957

  7. 4513861F-C564-42D2-BC9F-5FAED19E993E
    4513861F-C564-42D2-BC9F-5FAED19E993E avatar
    4090 posts
    Member since:
    Apr 2022

    Posted 17 Sep 2020 Link to this post

    Hi Roberto,

     

    I am afraid this Code Library is no longer valid. It was an experimental attempt and didn't work properly in the long run. The main conclusion is that this feature is not related to RadGrid and cannot be handled on RadGrid level, but on the database level.

    Thank you for your understanding. More information you can find on my previous reply in this thread. I am now closing this thread.

     

    Regards,
    Eyup
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.