This is a migrated thread and some comments may be shown as answers.

Reducing the filteroptions in the HeaderContextMenu

4 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul Evers
Top achievements
Rank 2
Paul Evers asked on 01 Nov 2011, 10:55 AM
I want to reduce the filteroptions which are presented in the dropdownboxes in the headercontextmenu of a Radgrid. I want to hide options like IsNull, NotIsNull, etc.
How do I do this?

Paul

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Nov 2011, 11:03 AM
Hello Paul,

Check the following help documentation which explains how to reduce filter menu options.
Reducing the Filter Menu Options.

Thanks,
Princy.
0
Paul Evers
Top achievements
Rank 2
answered on 01 Nov 2011, 11:09 AM
This does only change the filteroptions in the header. I use the HeaderContextMenu (EnableHeaderContextFilterMenu="True" ). The filteroptions in the dropdowsboxes are not changed  with the method you referred to.

Paul
0
Accepted
Princy
Top achievements
Rank 2
answered on 01 Nov 2011, 02:41 PM
Hello Paul,

You can try the following code snippet to remove IsNull and NotIsNull filter options.

C#:
protected void Page_Load(object sender, EventArgs e)
{
  RadGrid1.HeaderContextMenu.ItemCreated+=new RadMenuEventHandler(HeaderContextMenu_ItemCreated);
}
void  HeaderContextMenu_ItemCreated(object sender, RadMenuEventArgs e)
{
foreach (Control c in e.Item.Controls)
 {
  RadComboBox combo = c as RadComboBox;
  if (combo != null)
  {
   int itemcount = combo.Items.Count;
   int s = itemcount - 3;
   while (combo.Items.Count > s)
    {
     combo.Items.Remove(combo.Items.Count - 1);
    }
  }
 }
}

Thanks,
Princy.
0
Paul Evers
Top achievements
Rank 2
answered on 02 Nov 2011, 10:49 AM
Thanks. This works!!

Paul
Tags
Grid
Asked by
Paul Evers
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Paul Evers
Top achievements
Rank 2
Share this question
or