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

Dynamic filtering

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kim
Top achievements
Rank 1
Kim asked on 28 Jan 2012, 05:22 AM

Is there a way I can get the grid to filter my results dynamically as I type into a text box?

Thx.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Jan 2012, 06:44 AM
Hello,

Try the following code.
C#:
protected void Page_Load(object sender, EventArgs e)
    {
        RadGrid1.FilterMenu.Items.Clear();
        GridFilterMenu filterMenu = RadGrid1.FilterMenu;
        RadMenuItem menuItem = new RadMenuItem();
        RadGrid1.FilterMenu.Items.Add(menuItem);
        menuItem.Text = "Custom-Text (Contains)";
        menuItem.Value = "Contains";
        filterMenu.ItemClick += new RadMenuEventHandler(filterMenu_ItemClick);
    }
    void filterMenu_ItemClick(object sender, RadMenuEventArgs e)
    {
        GridFilteringItem filterItem = RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem;
        filterItem.FireCommandEvent("Filter", new Pair(e.Item.Value, e.Item.Attributes["OrderId"]));
    }

Also take a look into this demo.

-Shinu
Tags
Grid
Asked by
Kim
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or