MultiColumnComboBox in DataGridView

4 posts, 0 answers
  1. Lance
    Lance avatar
    7 posts
    Member since:
    Feb 2012

    Posted 09 Jan 2013 Link to this post

    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?
  2. Plamen
    Admin
    Plamen avatar
    132 posts

    Posted 11 Jan 2013 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Lance
    Lance avatar
    7 posts
    Member since:
    Feb 2012

    Posted 11 Jan 2013 Link to this post

    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!
  5. Plamen
    Admin
    Plamen avatar
    132 posts

    Posted 16 Jan 2013 Link to this post

    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.
Back to Top