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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I hide the "Custom" option in the filterbar dropdown?

To achieve this, implement a custom filter bar cell that derives the cell model/cell renderer from the GridTableFilterBarCellModel/GridTableFilterBarCellRenderer.

The GridTableFilterBarCellModel.FillWithChoices method is overridden to remove the string Custom from the list.

C#

VB

The GridTableFilterBarCellModel.Select method is rewritten with the Select_withoutcustom method that specifies the index for the selected item. You can pass the index for the Custom selected item as 0.

C#

VB

The GridTableFilterBarCellModel.ListBoxMouseUp() method is overridden to invoke the Select_withoutcustom method instead of the Select method.

C#

VB

A new CellType is created by adding the instance of the derived GridTableFilterBarCellModel class into the GridGroupingControl’s cellmodels.

C#

VB

After applying the properties, the Grid is displayed as follows.

Figure 1: Hiding the custom option

Sample Links

CS: Hiding custom_option

VB: Hiding custom_option

Article ID: Published Date: Last Revised Date: Platform: Control:
666 04/30/2011 02/12/2016 Windows Forms GridGroupingControl
Did you find this information helpful?
Comments
maurizio ziraldo Jun 11, 2015
This solution has a problem when you have some hidden columns. Add this line of code to your sample in Form1.cs: this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove("Name"); then run the sample and try to filter by WorkingBranch: you will see that the filter is applied to the wrong column City. To avoid this you can change this line: string _columnName = _grid.TableDescriptor.Columns[_filed].Name; with string _columnName = _grid.TableDescriptor.VisibleColumns[_filed].Name; in ListBoxMouseUp event of custom Cell Model.
Reply
Venkatesh Sundaram [Syncfusion] Jun 12, 2015
Hi Maurizio , Thanks for your valuable suggestions. We have modified the sample as per your suggestions and the sample link is updated in the kb article. please let us know if you have any concerns. Thanks and Regards, Venkat.
Reply
Add Comment
You must log in to leave a comment

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