Tuesday, December 11, 2012

Removing RadGrid Filter Menu Items




RadGrid filters consist of number of filtering options but we might not need all of those options to be available. Below code on RadGrid Init event will only retain the specified filtering options.

protected void RadGrid1_Init(object sender, EventArgs e)

    {
         GridFilterMenu menu = RadGrid2.FilterMenu;
        int i = 0;

        while (i < menu.Items.Count)
        {
            if (menu.Items[i].Text == "NoFilter" || menu.Items[i].Text == "Contains" || menu.Items[i].Text == "EqualTo")
            {
                i++;
            }
            else
            {
                menu.Items.RemoveAt(i);
            }
        }
    }

No comments:
Write comments
Recommended Posts × +