ComponentOne True DBGrid for WinForms
Data Presentation Techniques / Filtering Data in DataSets / Adding a Filter Drop-Down List
In This Topic
    Adding a Filter Drop-Down List
    In This Topic

    In addition to the filter bar, you can also include a drop-down filter list in the filter bar. The drop-down list lists every item in that column and provides a simple way that users can choose what items to filter the column by without entering their own value.

    For example in the following code, the FilterDropDown property in the second filter bar cell is set to True:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' Display the filter bar.
    Me.C1TrueDBGrid1.FilterBar = True
    ' Allow the first column to be filtered by multiple items.
    Me.C1TrueDBGrid1.Columns(1).FilterDropDown = True
    ' Allow the first column to be filtered by multiple items.
    Me.C1TrueDBGrid1.Columns(1).FilterMultiSelect = True
    

    To write code in C#

    C#
    Copy Code
    // Display the filter bar.
    this.c1TrueDBGrid1.FilterBar = true; 
    // Allow the first column to be filtered by multiple items.
    this.c1TrueDBGrid1.Columns[1].FilterDropDown  = true;
    // Allow the first column to be filtered by multiple items.
    this.c1TrueDBGrid1.Columns[1].FilterMultiSelect = true;
    

    If you run the application, you'll notice that you can select the filter drop-down list to choose what to fiter the column by:


    Click check boxes to choose items that will be displayed. Checked items will be displayed and items with cleared check boxes will not be displayed. Click the Apply button in the filter bar to apply the filter criteria. Click the Clear button to clear the filter. Click the Close button to close the drop-down list.

    See Also