Giter VIP home page Giter VIP logo

accent-insensitive-filtering-in-aspxgridview-with-a-server-mode-data-source-t190796's Introduction

Files to look at:

Accent-insensitive filtering in ASPxGridView with a Server Mode data source

When ASPxGridView is bound to a server mode data source, all data operations are performed on the database server: Binding to Large Data (Database Server Mode)?. Thus, results depend on database settings. For instance, filtering data with diacritic signs depends on the default collation of your data server:
[CodeProject.com] Configuring SQL Server Accent-Insensitivity
[Stackoverflow.com] Questions about accent insensitivity in SQL Server (Latin1_General_CI_AS)?

In other words, the first solution to achieve accent-insensitive filtering when the grid is bound to the server mode datasource is to change collation on the server. 
Another solution is to create a custom filter operator by implementing ICustomFunctionOperator and  ICustomFunctionOperatorFormattable interfaces and modify a filtering request to the database in the ICustomFunctionOperatorFormattable.Format method:

string ICustomFunctionOperatorFormattable.Format(Type providerType, params String[] operands) {
    var operand = string.Format("N'%{0}%'", operands[0].Split('\'')[1]);
    return string.Format("{0} COLLATE SQL_Latin1_General_CP1_CI_AI LIKE {1} ", operands[1], operand);
}
Private Function ICustomFunctionOperatorFormattable_Format(ByVal providerType As Type, ParamArray ByVal operands() As String) As String Implements ICustomFunctionOperatorFormattable.Format
    Dim operand = String.Format("N'%{0}%'", operands(0).Split("'"c)(1))
    Return String.Format("{0} COLLATE SQL_Latin1_General_CP1_CI_AI LIKE {1} ", operands(1), operand)
End Function

 

In this case, the accent-insensitive collation is applied only for filtering. Note that this approach is not supported by LINQ-based ORMs.

This example demonstrates how to implement accent-insensitive filtering in Auto Filter Row when ASPxGridView is bound to XpoDataSource with Server Mode enabled. To test the example, download the solution to your local machine.

See Also:
How to make the Grid's filter to be a case- and accent-insensitive in Server Mode
E4836: How to create a custom ASPxGridView's filter insensitive to the number of spaces and punctuation

Description

  1. Run the "DatabaseUpdater" project;
    2) Generate sample data;
    3) Run XpoWebApplication project.

accent-insensitive-filtering-in-aspxgridview-with-a-server-mode-data-source-t190796's People

Contributors

devexpressexamplebot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.