Reducing the filteroptions in the HeaderContextMenu

5 posts, 1 answers
  1. Paul Evers
    Paul Evers avatar
    52 posts
    Member since:
    Oct 2011

    Posted 01 Nov 2011 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Nov 2011 Link to this post

    Hello Paul,

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

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Paul Evers
    Paul Evers avatar
    52 posts
    Member since:
    Oct 2011

    Posted 01 Nov 2011 Link to this post

    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
  5. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Nov 2011 Link to this post

    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.
  6. Paul Evers
    Paul Evers avatar
    52 posts
    Member since:
    Oct 2011

    Posted 02 Nov 2011 Link to this post

    Thanks. This works!!

    Paul
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017