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

2 Answers 2

5

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

0
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.

1
  • 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 Layout
    – Zyku
    Apr 6, 2012 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.