One of the columns of my UltraGrid uses a ValueList from int to string to display the record label on the screen for the related id as integer.
A record has the label "0830 (0800)". When I enter "08" in the filter of that column, that row is filtered out. The tooltip on the filter cell displays "Contains '8'".
I changed the column.FilterComparisonStyle to DisplayTextOnly, but this behavior is still the same.
My goal is to filter only for the DisplayText and ignore the values of the ValueList.
How can I accomplish this?
I don't see a reason why this wouldn't work. Which version of Infragistics are you using? It's possible that what your seeing is a bug.
We are using 15.2 and 18.2. We see the same behavior on both versions.
I expect you have probably moved on from this, but we have looked into the issue more deeply and the underlying cause is extremely complex and so the developers have decided it would be too dangerous to "fix" it in the control.
However, I have discovered that one root of the problem is that when you use FilterOperandStyle.Edit, the filter cell converts what you type to the DataType of the column. So the filter condition is looking for a Numeric zero instead of a string zero. And then the filter itself ends up running that value through the ValueList and looking for the wrong test entirely.
The practical implications of that is that there's another potential workaround. If, for some reason, you don't like the other workarounds I gave you and you really want to set the FilterOperandStyle.Edit, you can still make the filter work correctly by forcing the filter conditions for the column to always use a string.
private void UltraGrid1_BeforeRowFilterChanged(object sender, BeforeRowFilterChangedEventArgs e)
if (e.NewColumnFilter.Column.Key == "Int32 1")
foreach (FilterCondition filterCondition in e.NewColumnFilter.FilterConditions)
if (!(filterCondition.CompareValue is string))
filterCondition.CompareValue = filterCondition.CompareValue.ToString();
Thank you for the tip, Mike.
We haven't moved on with this issue. It's currently on hold. So, we are open to ideas and fixes from your side.
Unfortunately, the fix above didn't solve all the cases.
"0" => Solved
Any integer value that doesn't start with 0 => Solved
"0X" where X is an integer => filter key is resolved to X, and the filtering is executed with the query "contains 'X'" instead of "contains '0X'".
Unfortunately, we have many clients that use record labels in the form of "0X:YZ abc" where XYZ are all integers.
I'm confused. I have attached here the sample I have been using to test this. In my sample, there's an item in the ValueList with text: "0830 (0800)" - which is the text you used in your original post.
So if I understand you correctly, you are saying that using the latest workaround I posted, if you type an "8" into the filter cell, it doesn't work and cells that contain "0830 (0800)" are filtered out when they should not be.
But I tried this out with my sample and it works fine. So what am I missing here?
Sorry for providing you with incomplete information.
The cells that contain "0830 (0800)" aren't filtered out. They are kept on the grid, which is expected behavior.
The problem is that there are other cells that contain the char '8', but not the string '08'. They are displayed as well when they should be filtered out.
Example: a cell that contains 'abc 8:45' isn't filtered out when I type in '08' in the filter cell. In this case the filter query reads as "contains '8'".
Oh, I see. That makes sense, since the filter cell will convert "08" into a numeric value of 8 and thus lose the 0. So I guess that third workaround is no good and you will need to use one of the other two. Sorry for the confusion, I never thought about leading zeroes.
No problems. Thank you for the tip anyway!