
I have a Grid which has a couple of aggregated footers. They even work OK.
However, I cannot get it to display localized values. This is the markup I'm using:
<
telerik:GridNumericColumn
DataField
=
"Quantity"
DataType
=
"System.Int32"
UniqueName
=
"Quantity"
FooterAggregateFormatString="<%$ Resources:strings,strNumberOfProducts%>" Aggregate="Sum">
<
HeaderStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Right"
Width
=
"50"
/>
</
telerik:GridNumericColumn
>
I even tried to set the Culture property of the grid, but no luck.
Any idea on what I'm doing wrong?
v
9 Answers, 1 is accepted
I followed your scenario and prepared a sample test project which is working as expected. Please give it a try and let me know if it helps to resolve the problem.
Regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Unfortunately, I cannot try your sample project as I am not set up for asp 4.0. My project is on 3.5.However, from what I see there are a few differences between your and my project:
- in the page directive you put this extra: (I tried this - didn't help)
-
meta:resourcekey="PageResource1"
2. You used groupexpression, which I don't need, but assume wouldn't make much difference.
The rest shouldn't be relevant.
Since I don't have 4.0 I couldn't try if your example works, I can only see one set of strings - nothing about picking up different cultures. In my app it also picks up the default language, but not the localized ones.
If it's not much trouble, can you please modify your sample to:
a. use asp.net 3.5
b. use at least two sets of cultures
c. use a plain xml file (so that I don't need Northwind... :-) )
thanks
Attached to this message is 3.5 version of the project.
Kind regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Thanks for the quick replies!
With your own sample I have now been able to demonstrate that it does NOT pick up the localized strings. Yes, when there is only one strings.resx file is present, it takes the string from there. However, I added another file, called it strings.hu.resx and I changed the string. In this case still the English string gets displayed. In the codebehind I added the following lines:
protected
void
Page_Load(
object
sender, EventArgs e)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(
"hu"
);
Thread.CurrentThread.CurrentUICulture =
new
CultureInfo(
"hu"
);
}
Still, the string is displayed comes from strings.resx. I even tried to add Culture="hu" to the grid, but the result is the same.
The weird thing is that all other strings in the grid do get localized with te method you demonstrated, and that's what I've been using so far with no problem. It's only the aggregated footer that has this behaviour.
Please find my project attached. (Please rename it to zip...)
I am sending you modified project which is working as expected. Give it a try and let me know if I am leaving something out from your logic.
Kind regards,
Pavlina
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!

First of all, thank you for sticking with me on this issue.
I'm afraid you are still missing the point (or rather I am not making myself clear):
Your sample code works because you are not using multiple language resources. When you add FooterAggregateFormatString="<%$ Resources:Stringshu,strNumberOfProducts%>" it will always pick up the resources found in the file Stringshu - no matter what culture the grid is set to.
Try to create two buttons or something to programmatically switch between the two languages and you will see that no matter what, the English (default) resorces are displayed.
Thank you again!
I followed your scenario and prepared a sample test project which handles the desired functionality. Please give it a try and let me know if it works for you.
Greetings,
Pavlina
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!

Yes, this version works, but this is a workaround, not a solution. This is what I am using at the moment until I find a proper fix for this issue.
This is how any other control works: When I set Thread.CurrentCulture, all the strings scome from the Strings.<languagecode> file. This is not the case with the FooterAggregateFormatString. Of course, if I set it programmatically to take strings from a completely different resource file, it works, but imagine having to do this for all the strings across all the languages in a project and you'll quicly see that this CANNOT be the proper way.
cheers
viktor
In order to implement this functionality, you need to:
1) Name the resource files as explained in MSDN and in our documentation:
ASP.NET Web Page Resources Overview
Localization through global resources
Example:
RadGrid.Main.en-US.resx
RadGrid.Main.hu-HU.resx
Of course you can still use "Strings.en-US.resx" but RadGrid won't pick this resource if you name it this way.
2) Add your custom string to the resource file and set it to the FooterAggregateFormatString property explicitly:
FooterAggregateFormatString="<%$ Resources: RadGrid.Main, FooterAggregateFormatString %>"
Excerpt from the resource file:
<
data
name
=
"FooterAggregateFormatString"
xml:space
=
"preserve"
>
<
value
>huHU</
value
>
</
data
>
Make sure that you have ReservedResource string, as it is required for RadGrid.
3) Change the UI culture in the body of the overridden InitializeCulture method. Sample code:
protected
override
void
InitializeCulture()
{
if
(Request.UserLanguages !=
null
)
{
string
defLang = HttpContext.Current.Request.UserLanguages[0];
CultureInfo cultureInfo = Array.Find(CultureInfo.GetCultures(CultureTypes.AllCultures), p => p.Name == defLang);
if
(cultureInfo !=
null
)
System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo;
}
base
.InitializeCulture();
}
4) Set the desired language in your browser. For Internet Explorer, please follow these steps:
- Open Tools menu (ALT + T)
- Click on Languages
- Add the desired language by clicking on the Add button
- Make sure that the selected language is on the top of the list. You can use the Move Up and Move Down buttons to change its position.
- Refresh the page
Note that you need the latest version of RadControls for ASP.NET AJAX (Q2 2011), otherwise you will have to set RadGrid culture manually from code-behind.
For your convenience I have attached a simple demo.
Best regards,
Daniel
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!