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

Custom localizations in multiple RadGrids

2 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick Haworth
Top achievements
Rank 1
Nick Haworth asked on 23 Sep 2011, 03:27 PM
Hi,

I am in the process of converting many Repeater and GridView controls into RadGrid controls but have come across an issue when trying to apply specific localizations.

For example, previously I could very easily localize a column header in a GridView by simple adding meta:resourcekey="projectName" to a Localize control within the HeaderTemplate, but how could I translate the header text in this:

......
            <telerik:GridBoundColumn HeaderText="Project Name:" ReadOnly="True" DataField="ProjectName" UniqueName="assessmentsNameCol">
                <ItemStyle Width="20%" />
                <HeaderStyle Width="20%" CssClass="hor" />
            </telerik:GridBoundColumn>
......


We serve all our localizations directly from a database, so simply adding projectName.Text and projectName.Tooltip values would previously allow us to immediately translate this column - on a page-specific basis.

I have read several forum posts about how to add globalization entries for RadGrids, but this will not work if I have different RadGrids trying to use the same resx file.

How can I achieve this level of customization using RadGrids?  Do I HAVE to use Globalizations?  If so, how can I change the name of each globalization file that each RadGrid uses (so that I can have 1 set of .resx files for each grid)?

Thanks in advance,


Nick

2 Answers, 1 is accepted

Sort by
0
Nick Haworth
Top achievements
Rank 1
answered on 26 Sep 2011, 01:27 PM
UPDATE:

I have now realised that I am able to add page-specific translations for RadGrid column headers directly in the aspx (via HeaderText='<%$ resources:X/PageName.aspx,projectName.Text %>' ).  But now I would like to be able to translate some common resource keys that will be used by all grids (such as "Page size: " ).  As previously stated, we serve our localizations from the database, and using SQL profiler, I can see this command being executed:

exec sp_executesql N'select ResourceId,Value,Type,BinFile,TextFile,FileName from Localizations where  ResourceSet=@ResourceSet and LocaleId=@LocaleId order by ResourceId',N'@ResourceSet nvarchar(12),@LocaleId nvarchar(2)',@ResourceSet=N'RadGrid.Main',@LocaleId=N'fr-FR'

Having already manually added the invariant and translated value for the resource id for the label "Page size: " ("PageSizeLabelText"), I expect to see the french translation for this value to be displayed, but it isn't.  The invariant translation is not even displayed when I use a culture that has no culture-specific translation.

What am I missing?
0
Nick
Top achievements
Rank 1
answered on 27 Sep 2011, 10:39 AM
I have just resolved this issue.  I had not added the "ReservedResource" resource id!
Tags
Grid
Asked by
Nick Haworth
Top achievements
Rank 1
Answers by
Nick Haworth
Top achievements
Rank 1
Nick
Top achievements
Rank 1
Share this question
or