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

MultiColumnComboBox in DataGridView

3 Answers 254 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Lance
Top achievements
Rank 1
Lance asked on 09 Jan 2013, 10:27 PM
I am using a multicolumncombobox inside a datagridview. I would like to set a filter on the combobox so that when the user types a letter, the combobox filters the available options.

Is this possible?

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 11 Jan 2013, 03:04 PM
Hi Lance,

Thank you for writing.

Filtering operation in RadMultiColumnComboBox is controlled by the boolean AutoFilter property. The data is filtered by the field specified as DisplayMember. In addtion you should set the filter expression (telling the control the rules it should use to filter the data) and add that expression to MasterTemplate. Read our documentation article about filtering in RadMultiColumnComboBox: http://www.telerik.com/help/winforms/multicolumncombobox-filtering.html

I hope this helps.

All the best,
Plamen
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Lance
Top achievements
Rank 1
answered on 11 Jan 2013, 03:10 PM
Thanks for your response. I actually figured out how to achieve what I needed by using another example I found on the DataGridView forum:

void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)

{

    RadMultiColumnComboBoxElement multiComboElement = this.radGridView1.ActiveEditor as RadMultiColumnComboBoxElement;

    if (multiComboElement != null)

    {

        multiComboElement.EditorControl.MasterTemplate.BestFitColumns();

        multiComboElement.DropDownStyle = RadDropDownStyle.DropDown;

        multiComboElement.AutoFilter = true;

        if (multiComboElement.EditorControl.FilterDescriptors.Count == 0)

        {

            multiComboElement.EditorControl.FilterDescriptors.Add(multiComboElement.DisplayMember, FilterOperator.StartsWith, String.Empty);

        }

    }

}


Thanks!
0
Plamen
Telerik team
answered on 16 Jan 2013, 07:45 AM
Hi Lance,

Thank you for the shared code snippet. I can confirm that this is the correct way to enable the auto filtering in GridViewMultiComboBoxColumn.

Kind regards,
Plamen
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
MultiColumn ComboBox
Asked by
Lance
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Lance
Top achievements
Rank 1
Share this question
or