Completed
Last Updated: 04 Mar 2013 06:18 by Svetlin
Svetlin
Created on: 04 Mar 2013 06:18
Category: GridView
Type: Bug Report
0
FIX. Filtering does not work when NotConains and Contains filters are combined.
Filtering does not work correctly when NotConains and Contains filters are combined.

Work around:

private void radGridView1_FilterExpressionChanged(object sender, FilterExpressionChangedEventArgs e)
        {
            List<string> filterExpressions = new List<string>();

            for (int i = 0; i < this.radGridView1.FilterDescriptors.Count; i++)
            {
                FilterDescriptor descriptor = this.radGridView1.FilterDescriptors[i];
                string expression = null;

                CompositeFilterDescriptor compositeFilterDescriptor = descriptor as CompositeFilterDescriptor;

                if (compositeFilterDescriptor != null)
                {

                    expression = CompositeFilterDescriptor.GetCompositeExpression(compositeFilterDescriptor);
                }
                else
                {
                    expression = FilterDescriptor.GetExpression(descriptor);
                }

                if (!string.IsNullOrEmpty(expression))
                {
                    filterExpressions.Add("(" + expression + ")");
                }
            }

            string logicalOperator = (this.radGridView1.FilterDescriptors.LogicalOperator == FilterLogicalOperator.And) ? " AND " : " OR ";
            string resultExpression = String.Join(logicalOperator, filterExpressions.ToArray());
            e.FilterExpression = resultExpression;
        }
0 comments