XtraGridView Custom Filter on AutoFilterRow

Go To StackoverFlow.com

3

Hy , I have an XtraGrid with AutoFilterRow
the default Filter is :

Starts with([columnName], 'mytext')

but i want to change this to :

[columnName] like '%mytext%'

without creating a Custom Filter

i just want to open the grid , write inside FilterRow 'mytext' and Filter LIKE should by apply to my column

a solution is to catch when the Filter is changed , to create the string and

gridView1.Columns["myCol"].FilterInfo = mystring;

but i do not know how to catch the inserted text

thanks in advance

2012-04-05 15:01
by Zyku


5

You need to change the OptionsColumnFilter.AutoFilterCondition option to achieve the desired result.

2012-04-05 19:26
by Uranus
works perfectly , thanks a lo - Zyku 2012-04-06 06:14


3

If you already have this:

Starts with([columnName], 'mytext')

You should be able to go into the XtraGrid Designer, select Layout and at the bottom of the Grid Preview window you can click the "Edit Filter" link which will bring up the Filter Editor.

enter image description here

Change the "Begins With" to "Contains" which is the same as LIKE.

enter image description here

If that doesn't solve what you're trying to do, the other half of your question was where to catch the filter events. The GridView has a few events and the two that you would be interested in are FilterEditorCreated and ShowFilterPopupListBox.

2012-04-05 18:27
by Brad Rem
it doesn't work , 1st I don't know I don't see the Contains condition when I hit 'Edit Filter' , and second if I put 'Equal' for example , run the code it starts with condition 'Equal' but when i am inserting something in Filter the condition changes with 'Start with' , anyway thanks a lot , i didn't know you can do that in Layou - Zyku 2012-04-06 06:08
Ads