We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Search in multiple columns

Thread ID:

Created:

Updated:

Platform:

Replies:

63861 Jul 10,2007 11:35 PM UTC Jul 10,2007 11:43 PM UTC WinForms 1
loading
Tags: Grouping
Haishi
Asked On July 10, 2007 11:35 PM UTC

Hi:

Is it possible to express "Column A is like '*ABC*' OR Column B is like '*ABC*'" using RecordFilters? See the following code - I'm trying to search for a pattern in all columns.

this.grid.TableDescriptor.RecordFilters.Clear();
for (int i = 0; i < this.grid.TableDescriptor.Columns.Count; i++)
{ this.grid.TableDescriptor.RecordFilters.Add(new RecordFilterDescriptor(this.grid.TableDescriptor.Columns[i].MappingName,
FilterLogicalOperator.Or, new FilterCondition[] { new FilterCondition(FilterCompareOperator.Like, "*ABC*") }));
}
}

But it seemed the criteria are applied as "AND" conditions - if I only use the column that actually contains the text it works, but whenever i include a second column that doesn't contain the text i get empty result.

Haishi
Replied On July 10, 2007 11:43 PM UTC

To answer myself, use

this.grid.TableDescriptor.RecordFilters.LogicalOperator = FilterLogicalOperator.Or;

The FilterLogicalOperator.Or in original code specifies the logical operation among the FilterCondition[], while this statment controls how the RecordFilterDescriptors are conjuncted.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;