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

Custom Filter in HeaderContextMenu of RadGrid

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karsten
Top achievements
Rank 1
Karsten asked on 19 Oct 2010, 01:55 PM
Hello,

i want to create a very simple filter in the headercontextmenu of a radgrid.
The filter should consist of one textbox.
If the "enter"-key is pressed, the grid-content should be filtered.
The filter should be work per column.

Is this possible?
Can you explain me, how i can realize this?

I've attached two files (screenshots).
FilterIst.jpg = this is the filter in my current grid.
FilterSoll.jpg = this is the filter, i want to have.

kind regards
Karsten

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 25 Oct 2010, 07:48 AM
Hello Karsten Doering,

This scenario is not supported out of the box. You have to manually configure the RadContextMenu to show menu item containing a textbox and filtering the grid. You can do that by wiring the OnPreRenderComplete event handler for the page and adding a new menu item with the desired control in it, and also configure the menu item per column by setting the special attributes: ColumnName and TableID as well as adding additional settings depending on column type if needed. Here is a code sample on how to achieve this:
protected override void OnPreRenderComplete(EventArgs e)
        {
            RadContextMenu menu = RadGrid1.HeaderContextMenu;
            RadMenuItem item = new RadMenuItem();
            TextBox txtBox = new TextBox();
            txtBox.ID = "txtBox1";
            txtBox.AutoPostBack = true;
            txtBox.TextChanged += new EventHandler(txtBox_TextChanged);
            item.Controls.Add(txtBox);
            item.Attributes["ColumnName"] = string.Empty;
            item.Attributes["TableID"] = string.Empty;
            menu.Items.Add(item);
            base.OnPreRenderComplete(e);
        }
You may find futher information on customizing the FilterContextMenu in this help article.

All the best,
Marin
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Karsten
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or