
Thanks in advance
4 Answers, 1 is accepted
Thank you for writing.
This a known issue when localizing RadGridView's column headers. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.
Currently, the possible solution that I can suggest is to set the HeaderText programmatically according to the current language.
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik by Progress


Hi my approach is to store model's translation by using DisplayAttributes,
for example
class XYZ{
[Display(Name =
"MyDisplayName"
,
ResourceType=
typeof
(MyResourceFileName))]
public
String ArbitrationLong
{
get
;
set
;
}
///...
}
then on the resource file MyResourceFileName add the properties translation.
the above tecnique is quite useful, many tools automatically interpret them correctly, if you will use your class on an ASP.NET MVC all the helpers will automatically translate your labels, and also the telerik kendo ui grid is able to automatically use the correct grid header if your model have such attributes.
To return to telerik grid on winforms, at the time i don't think the telerik grid for winforms is automatically able to use the model's attributes, but you just need the above snippet they are few lines of code : It works for ITypedList datasources, otherwise you could retrieve the properties using reflection, what you have to modify is the first row on the above snippet all the other code remain the same, you can store the above snipped in any static function and call it as is, it needs a list of properties and a grid as parameters.
var props = (TheList
as
ITypedList).GetItemProperties(
null
);
foreach
(var column
in
theGrid.Columns)
{
var cprop = props.Find(column.FieldName,
true
);
if
(cprop !=
null
)
{
var display = cprop.Attributes.OfType<DisplayAttribute>().FirstOrDefault();
if
(display !=
null
)
{
if
(display.ResourceType ==
null
)
column.HeaderText = display.Name;
else
{
var dprop = display.ResourceType.GetProperty(display.Name, BindingFlags.Public | BindingFlags.Static);
if
(dprop ==
null
)
column.HeaderText = display.Name;
else
column.HeaderText = dprop.GetValue(
null
,
null
).ToString();
}
}
}
}
Best Regards
Thank you for writing back.
The provided sample code snippet is greatly appreciated. We will consider it when addressing the feedback item.
If you have any additional questions, please let me know.
Regards,
Dess
Telerik by Progress