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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to hide (Custom....) option from filter bar dropdown list?

To remove the (Custom….) option from the FilterBar dropdown list , you need to customize GridListFilterBarCellRenderer using TableControlCurrentCellShowingDropDown, TableControlCurrentCellCloseDropDown events.

 

C#:

private void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e) {
        GridCurrentCell cc e.TableControl.CurrentCell;
        if ((cc.Renderer.GetType() == GridListFilterBarCellRenderer)) {
            GridListFilterBarCellRenderer renderer ((GridListFilterBarCellRenderer)(cc.Renderer));
            if (((renderer.ListControlPart.SelectedIndex >1
                        && (renderer.ListControlPart.SelectedIndex 
                        <(renderer.ListControlPart.Items.Count - 1)))) {
                renderer.ListControlPart.SelectedIndex (renderer.ListControlPart.SelectedIndex + 1);
            }
        }
    }


    private void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e) {
        GridCurrentCell cc e.TableControl.CurrentCell;
        if ((cc.Renderer.GetType() == GridListFilterBarCellRenderer)) {
            GridListFilterBarCellRenderer renderer ((GridListFilterBarCellRenderer)(cc.Renderer));
            GridTableCellStyleInfo tableStyleInfo ((GridTableCellStyleInfo)(renderer.StyleInfo));
            renderer.ListControlPart.Items.RemoveAt(1);
        }
    }

VB:

Private Sub gridGroupingControl1_TableControlCurrentCellCloseDropDown(ByVal sender As ObjectByVal As GridTableControlPopupClosedEventArgs)
        Dim cc As GridCurrentCell e.TableControl.CurrentCell
        If (TypeOf cc.Renderer Is GridListFilterBarCellRenderer) Then
            Dim renderer As GridListFilterBarCellRenderer = CType(cc.Renderer,GridListFilterBarCellRenderer)
            If ((renderer.ListControlPart.SelectedIndex >1)  _
                        AndAlso (renderer.ListControlPart.SelectedIndex  _
                        <(renderer.ListControlPart.Items.Count - 1))) Then
                renderer.ListControlPart.SelectedIndex (renderer.ListControlPart.SelectedIndex + 1)
            End If
        End If
    End Sub

 

    
    Private Sub gridGroupingControl1_TableControlCurrentCellShowingDropDown(ByVal sender As ObjectByVal As GridTableControlCurrentCellShowingDropDownEventArgs)
        Dim cc As GridCurrentCell e.TableControl.CurrentCell
        If (TypeOf cc.Renderer Is GridListFilterBarCellRenderer) Then
            Dim renderer As GridListFilterBarCellRenderer = CType(cc.Renderer,GridListFilterBarCellRenderer)
            Dim tableStyleInfo As GridTableCellStyleInfo = CType(renderer.StyleInfo,GridTableCellStyleInfo)
            renderer.ListControlPart.Items.RemoveAt(1)
        End If
    End Sub

Sample:

http://www.syncfusion.com/downloads/support/directtrac/general/HidingOption_FilterBar-682653859.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
2611 10/17/2014 02/13/2017 WinForms GridGroupingControl
Did you find this information helpful?
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