How do I remove/ dont display the Custom option from Rad Grid View Column -> Available Filters list?

1 Answer 66 Views
GridView
Cristi
Top achievements
Rank 1
Cristi asked on 03 Mar 2023, 04:56 PM

Please see the picture attached - I 'd like to display only the green options,

thank you

1 Answer, 1 is accepted

Sort by
1
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Mar 2023, 06:05 AM

Hello, Cristi,

I have prepared a sample code snippet demonstrating how to hide the "Custom" option from the Excel-like filter popup:

        public RadForm1()
        {
            InitializeComponent();

            this.radGridView1.EnableFiltering = true;
            this.radGridView1.ShowHeaderCellButtons = true; 
            this.radGridView1.FilterPopupInitialized += RadGridView1_FilterPopupInitialized;
        }

        private void RadGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e)
        {
            RadListFilterPopup popup = e.FilterPopup as RadListFilterPopup;
            if (popup!=null)
            {
                foreach (RadItem item in popup.Items)
                {
                    if (item.Text == RadGridLocalizationProvider.CurrentProvider.GetLocalizedString(RadGridStringId.FilterMenuAvailableFilters))
                    {
                        RadMenuItem availableFilters = item as RadMenuItem;
                        foreach (RadItem subItem in availableFilters.Items)
                        {
                            if (subItem.Text == RadGridLocalizationProvider.CurrentProvider.GetLocalizedString(RadGridStringId.FilterOperatorCustom))
                            {
                                subItem.Visibility = ElementVisibility.Collapsed;
                            }
                        } 
                    } 
                }
            }
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Cristi
Top achievements
Rank 1
commented on 06 Mar 2023, 02:21 PM

Hi,

Your sample code it was what I was looking for.

Thank you, 
Cristi


Tags
GridView
Asked by
Cristi
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or