Infragistics Grid ColumnFilter filtering based on 2 column values
infragistics, ultrawingrid, winforms
Solution
I can think of one quick solution for this. The below code will set normal filters on 2 columns, then you just change the columns LogicalOperator.
private void Filter() {
Infragistics.Win.UltraWinGrid.FilterCondition fc = new Infragistics.Win.UltraWinGrid.FilterCondition();
fc.CompareValue = "someValue1";
fc.ComparisionOperator = Infragistics.Win.UltraWinGrid.FilterComparisionOperator.Equals;
ultraGrid1.DisplayLayout.Bands[0].ColumnFilters["col_x"].FilterConditions.Add(fc);
Infragistics.Win.UltraWinGrid.FilterCondition fc2 = new Infragistics.Win.UltraWinGrid.FilterCondition();
fc2.CompareValue = "someValue2";
fc2.ComparisionOperator = Infragistics.Win.UltraWinGrid.FilterComparisionOperator.Equals;
ultraGrid1.DisplayLayout.Bands[0].ColumnFilters["col_y"].FilterConditions.Add(fc2);
// set the logical operator of the columns on the band
ultraGrid1.DisplayLayout.Bands[0].ColumnFilters.LogicalOperator = Infragistics.Win.UltraWinGrid.FilterLogicalOperator.Or;
}
Is this what you were looking for?
Problem
I have 2 columns x and Y. I need to filter grid based on values of 2 columns. For example: Suppose my filter condition is true, then it should check the value of both the columns and if any of the column value is true it should not filter the row. If none of the value is true than the row should be filtered.