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

rename RadGridFilters

2 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rik butcher
Top achievements
Rank 1
rik butcher asked on 15 Jul 2011, 07:34 PM

i have a rad grid that allows filtering by column.
i found some great code to remove the menu items i don't want - works great. How can i rename the Display
to something else?i can't find anything on that for gradGridColumn Filters. i know how to do it for the regular RadFilters, but not these guys. 
thanks
rik 

GridFilterMenu
menu = MoveInvItemsRadGrid.FilterMenu;

int i = 0;

while (i < menu.Items.Count)

{

if (menu.Items[i].Text == "NoFilter" | menu.Items[i].Text == "StartsWith" | menu.Items[i].Text == "Contains" | menu.Items[i].Text == "EqualTo" | menu.Items[i].Text == "GreaterThan" | menu.Items[i].Text == "LessThan")

{

i = i + 1;

}

else

{

menu.Items.RemoveAt(i);

}

}

2 Answers, 1 is accepted

Sort by
0
rik butcher
Top achievements
Rank 1
answered on 15 Jul 2011, 08:32 PM
I tried this lil' diddy and it works but, sure is messy especially when i need to do Localization for another language.
is there a cleaner , less verbose way?
thanks
rik

GridFilterMenu

 

 

menu = AllAssignmentsRadGrid.FilterMenu;

 

 

 

for (int i = 0; i < menu.Items.Count; i++)

 

{

 

 

if (menu.Items[i].Text == "EqualTo") { menu.Items[i].Text = "=";}

 

 

 

else if (menu.Items[i].Text == "GreaterThanOrEqualTo") { menu.Items[i].Text = ">="; }

 

 

 

else if (menu.Items[i].Text == "StartsWith"){ menu.Items[i].Text = "Begins With"; }

 

 

 

else if (menu.Items[i].Text == "LessThanOrEqualTo") { menu.Items[i].Text = "<="; }

 

 

 

else if (menu.Items[i].Text == "NoFilter") { menu.Items.RemoveAt(i); }

 

 

 

else if (menu.Items[i].Text == "DoesNotContain") { menu.Items.RemoveAt(i); }

 

 

 

else if (menu.Items[i].Text == "EndsWith") { menu.Items.RemoveAt(i); }

 

 

 

else if (menu.Items[i].Text == "NotEqualTo") { menu.Items.RemoveAt(i); }

 

 

 

else if (menu.Items[i].Text == "GreaterThan") { menu.Items[i].Text = ">"; }

 

 

 

else if (menu.Items[i].Text == "LessThan") { menu.Items[i].Text = "<"; }

 

 

 

else if (menu.Items[i].Text == "NotBetween") { menu.Items.RemoveAt(i); }

 

 

 

else if (menu.Items[i].Text == "IsEmpty") { menu.Items.RemoveAt(i); }

 

 

 

else if (menu.Items[i].Text == "NotIsEmpty") { menu.Items.RemoveAt(i); }

 

 

 

else if (menu.Items[i].Text == "IsNull") { menu.Items.RemoveAt(i); }

 

 

 

else if (menu.Items[i].Text == "NotIsNull") { menu.Items.RemoveAt(i); }

 

}

0
Mira
Telerik team
answered on 21 Jul 2011, 06:19 AM
Hello Rik,

In order to localize the RadGrid with minimum efforts, I recommend that you use global resource files.
Please examine the corresponding demo and help topic for additional information.

I hope this helps.

Greetings,
Mira
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
rik butcher
Top achievements
Rank 1
Answers by
rik butcher
Top achievements
Rank 1
Mira
Telerik team
Share this question
or