This is a migrated thread and some comments may be shown as answers.

Filtering several columns

3 Answers 129 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 03 Nov 2011, 08:38 AM
Hi there,

perhaps it is a stupid question, but I don't get it to work and I found nothing in the web.
I have a multicolumncombobox with 3 columns. I want to add a filter, which searches in all 3 columns and displays all results found in one of the 3 columns.
First I found the filterdescriptor class. That worked fine, but it displays only results, which are found in all 3 columns and not in one of them.
Then I tried to get it work with the compositefilterdescriptor. And that does not work for me. Perhaps someone has a hint. Here is my code:

Telerik.WinControls.Data.CompositeFilterDescriptor compositeDescriptor = new Telerik.WinControls.Data.CompositeFilterDescriptor();
compositeDescriptor.LogicalOperator = Telerik.WinControls.Data.FilterLogicalOperator.Or;
compositeDescriptor.FilterDescriptors.Add(new Telerik.WinControls.Data.FilterDescriptor("productNo", Telerik.WinControls.Data.FilterOperator.Contains, cbo_ProductMultiColumn.Text.ToString()));
compositeDescriptor.FilterDescriptors.Add(new Telerik.WinControls.Data.FilterDescriptor("productSearchName", Telerik.WinControls.Data.FilterOperator.Contains, cbo_ProductMultiColumn.Text.ToString()));
compositeDescriptor.FilterDescriptors.Add(new Telerik.WinControls.Data.FilterDescriptor("productName", Telerik.WinControls.Data.FilterOperator.Contains, cbo_ProductMultiColumn.Text.ToString()));
compositeDescriptor.IsFilterEditor = true;
this.cbo_ProductMultiColumn.EditorControl.FilterDescriptors.Add(compositeDescriptor);

Sorry, if it is a stupid question. I'm still a beginner. :-)

3 Answers, 1 is accepted

Sort by
0
Dennis
Top achievements
Rank 1
answered on 03 Nov 2011, 05:35 PM
I forgot to ask, if it is possible in general to add the compositefilterdescriptor to the mutlicolumncombobox. Is it?
0
Accepted
Svett
Telerik team
answered on 07 Nov 2011, 10:36 AM
Hello Dennis,

You should change the LogicalOperator property of the FilterDescriptorCollection:

this.radMultiColumnComboBox1.AutoFilter = true;
 
FilterDescriptor idFd = new FilterDescriptor("ID", FilterOperator.Contains, null);
this.radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(idFd);
 
FilterDescriptor companyNameFd = new FilterDescriptor("CompanyName", FilterOperator.Contains, null);
this.radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(companyNameFd);
 
this.radMultiColumnComboBox1.EditorControl.FilterDescriptors.LogicalOperator = FilterLogicalOperator.Or;

I hope this helps.

Regards,
Svett
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
Dennis
Top achievements
Rank 1
answered on 14 Nov 2011, 02:46 PM
Thank you. That worked fine.
Tags
MultiColumn ComboBox
Asked by
Dennis
Top achievements
Rank 1
Answers by
Dennis
Top achievements
Rank 1
Svett
Telerik team
Share this question
or