I need to modify a radgrid’s FilterMenu by replacing some text, such as “Order by”, “Contains” and “Does not contain”.
My attempted solution is to add an event handler to the menu’s ItemCreated event
grid.FilterMenu.ItemCreated += new RadMenuEventHandler(FilterMenu_ItemCreated);
And then when the ItemCreated event is fired, my method should simply look up some strings via the e.Item.Text object, and replace them.
void FilterMenu_ItemCreated(object sender, RadMenuEventArgs e)
{
if (e.Item.Text == "Group By") e.Item.Text = "Custom text";
}
But the FilterMenu_ItemCreated method to fire at all.
I’m confused about why, because I have used the same approach previously when modifying text in the HeaderContextMenu -and that worked perfectly fine.
Example:
radgrid.HeaderContextMenu.ItemCreated +=
new RadMenuEventHandler(HeaderContextMenu_ItemCreated);
…
void HeaderContextMenu_ItemCreated(object sender, RadMenuEventArgs e)
{
if (e.Item.Text == "Order By") e.Item.Text = "Custom text";
}
So this approach works for the HeaderContextMenu, but not for the FilterMenu.
Both event handlers are added after one another in the code, but only one of them works.
Any Ideas why?
Could it be that the RadMenuEventHandler isn’t the proper type of EventHandler for the FilterMenu.ItemCreated ? Can’t find any detailed documentation on Telerik’s site.
Please check below code snippet.