Customizing RadGridView Filter Box
1 Answer 14 Views
George C.
Top achievements
Rank 2
Iron
Veteran
George C. asked on 14 Jun 2021, 09:02 AM

Greetings,

Is there a way to hide some of the items of the radgridview filter box, or not showing the filter icon at all (marked with red circles in the attached picture) ?

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Jun 2021, 08:26 AM
Hello, George,  


You can hide the entire filter button or hide just some of the filter operators displayed in the popup. I have prepared two sample code snippets for your reference:

Example 1: Hide the filter button: 

        private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
        {
            GridFilterCellElement filterCell = e.CellElement as GridFilterCellElement;
            if (filterCell!=null)
            {
                filterCell.FilterButton.Visibility = ElementVisibility.Collapsed;
            }
        }


Example 2: Hide filter options from the menu: 
        public RadForm1()
        {
            InitializeComponent();
            this.radGridView1.EnableFiltering = true;

            this.radGridView1.ContextMenuOpening+=radGridView1_ContextMenuOpening;
        }

        private void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
        {
            if (e.ContextMenuProvider is GridFilterCellElement)
            {
                foreach (RadItem item in e.ContextMenu.Items)
                {
                    if (item.Text.Contains("Is null")|| item.Text.Contains("Equals"))
                    {
                        item.Visibility = ElementVisibility.Collapsed;
                    }
                }
            }
        }

Feel free to use this approach which suits your requirements best.

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/.

Asked by
George C.
Top achievements
Rank 2
Iron
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or