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

[Solved] How to declaratively localize PagerTextFormat text

5 Answers 131 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vasssek
Top achievements
Rank 1
Vasssek asked on 18 Apr 2013, 07:52 AM
Hello Telerik team,

I have been struggling with one issue, how to declaratively localize PagerTextFormat through App_GlobalResources custom file. I have created Application.resx file from which I want to add text to PagerTextFormat.

Here is the current definition inside of MasterTableView, which works normally:
<PagerStyle Mode="NextPrevAndNumeric" PagerTextFormat="{4}Celkový počet záznamov: <b>{5}</b>" />
In English it means: Total records: 18

Now, I want to make it multilingual, so I tried to replace text with variable from my .resx file, something like this:
<PagerStyle Mode="NextPrevAndNumeric" ShowPagerText="true" PagerTextFormat="{4}<%$ Resources: Application, String1 %>{5}" />

The problem is that Radgrid doesn't show my text from variable String1, instead of full text, it shows just number 18.

Please help me to solve this issue. I don't want to use codebehind solution...

Thank you.

Best regards

Vasssek

5 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 23 Apr 2013, 10:09 AM
Hi Vaclav,

The following topic demonstrates the exact steps you need to follow to achieve the requested localization:
http://www.telerik.com/help/aspnet-ajax/grid-localization-global-resources.html

Hope this helps.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Vasssek
Top achievements
Rank 1
answered on 23 Apr 2013, 11:26 AM
Hi Eyup,

I know how to do it via RadGrid.Main.resx file, but what I've tried to achieve is to change it through custom global resx file named (Application.resx), then it will apply just on current radgrid.

When I will change it in App_GlobalResources\RadGrid.Main.sk-SK.resx file, it will apply to all radgrids in my web application.

So, the question is, why it didn't show localized text in property PagerTextFormat="{4}<%$ Resources: Application, String1 %>{5}" as I wrote below...

Please help me to solve this issue.

Regards

Vasssek
0
Accepted
Eyup
Telerik team
answered on 26 Apr 2013, 08:11 AM
Hello Vaclav,

In such case, you will need to define the property programmatically:
protected void Page_Load(object sender, EventArgs e)
{
    RadGrid1.MasterTableView.PagerStyle.PagerTextFormat = "{4}" +
        GetGlobalResourceObject("Application", "String1") + ": {5}";
}

That should do the trick. Please give it a try and let me know if it works for you.

Regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Vasssek
Top achievements
Rank 1
answered on 28 Apr 2013, 05:35 AM
Hello Eyup ,

thank you for that code example. It worked as I expected.

How come, it doesn't work from radgrid declaration side ? Maybe you should add it into next official DLL release...

Best regrads

Vasssek
0
Accepted
Eyup
Telerik team
answered on 01 May 2013, 02:13 PM
Hello Vasssek,

It is too early in the page life cycle, therefore, the grid is not able to apply the localized text.

Thank you for the feedback. You can log it as a feature request:
http://feedback.telerik.com/Project/108

Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Vasssek
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Vasssek
Top achievements
Rank 1
Share this question
or