Hi,
I need to modify the item texts of a radgrid's FilterMenu ( for example changing "Order by", "Contains" and "Does not contain" to something else)
My attempted solution is to add a RadMenuEventHandler to the FilterMenu.ItemCreated event, so that when a filtermenu item is created, my method FilterMenu_ItemCreated will fire and replace the necessary texts.
However the FilterMenu_ItemCreated method never fires. And I'm not sure why
I've have previously been successful when using the same approach for modifying texts inthe HeaderContextMenu. I just added an event handler for the ItemCreatedEvent (like this:
So I'm confused why the same approach doesn't work for the FilterMenu
Below is some code:
----------------------
This is basically how the grid is set up. The event handler is added on the last line
A simplified version of the method which should fire during the ItemCreated event.
I need to modify the item texts of a radgrid's FilterMenu ( for example changing "Order by", "Contains" and "Does not contain" to something else)
My attempted solution is to add a RadMenuEventHandler to the FilterMenu.ItemCreated event, so that when a filtermenu item is created, my method FilterMenu_ItemCreated will fire and replace the necessary texts.
However the FilterMenu_ItemCreated method never fires. And I'm not sure why
I've have previously been successful when using the same approach for modifying texts inthe HeaderContextMenu. I just added an event handler for the ItemCreatedEvent (like this:
grid.HeaderContextMenu.ItemCreated +=
new
RadMenuEventHandler(HeaderContextMenu_ItemCreated);
) and that worked perfectly fine. So I'm confused why the same approach doesn't work for the FilterMenu
Below is some code:
----------------------
This is basically how the grid is set up. The event handler is added on the last line
RadGrid grid =
new
RadGrid();
grid.ID =
"radgrid1"
;
....
grid.MasterTableView.AllowFilteringByColumn =
true
;
grid.MasterTableView.EnableHeaderContextFilterMenu =
true
;
grid.HeaderContextMenu.ItemCreated +=
new
RadMenuEventHandler(HeaderContextMenu_ItemCreated);
grid.FilterMenu.ItemCreated +=
new
RadMenuEventHandler(FilterMenu_ItemCreated);
A simplified version of the method which should fire during the ItemCreated event.
void
FilterMenu_ItemCreated(
object
sender, RadMenuEventArgs e)
{
string
newHeader = RadGridHelper.GetLocalizedTextForFilterMenuItems(e.Item.Text);
if
(!String.IsNullOrEmpty(newHeader))
e.Item.Text = newHeader;
#if DEBUG
LogUtil.Log(String.Format(
"GetLocalizedTextForFilterMenuItems {0}"
, e.Item.Text));
#endif
}
public
static
string
GetLocalizedTextForFilterMenuItems(
string
text)
{
switch
(text)
{
case
"Between"
:
return
"Mellan"
;
}}