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

Column Header value from resource file

3 Answers 215 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ganesh
Top achievements
Rank 1
Ganesh asked on 11 Mar 2011, 09:16 PM
Hi,
I am having problem with gridview column header.
i have following code:

<telerikGridView:RadGridView.Columns>
<telerikGridView:GridViewDataColumn  Header="Server IP" DataMemberBinding="{Binding Machine}" IsReadOnly="True" />
</telerikGridView:RadGridView.Columns>




I would like the text "Server IP" to load from resx file in the project.
I tried traditional approach of  "{Binding Path=Resource.TEXT_VALUE1, Source={StaticResource LocalizedStrings}}"
but, then it doesnt work
May I know if anyone has encountered this problem ??
Any help in this regard is greatly appreciated.

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 12 Mar 2011, 09:41 AM
Hello Ganesh,

You may try to do the following:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
        <telerik:GridViewDataColumn.Header>
            <TextBlock  telerik:LocalizationManager.ResourceKey="Name" />
        </telerik:GridViewDataColumn.Header>                   
</telerik:GridViewDataColumn>          

In this case you need to have a key "Name" in your resources file.
 

Kind regards,
Maya
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Ganesh
Top achievements
Rank 1
answered on 14 Mar 2011, 03:40 PM
Hey
I tried that but it gives an error "GridViewDataColumn does not support direct content"
May i know if there is way around here
Thanks
0
Ganesh
Top achievements
Rank 1
answered on 14 Mar 2011, 10:01 PM
I have found a simple way around to fix this problem !
I went to code behind (c# file) then in the constructor part of class, i initialized the resource manager and passed the path of resex file and name of executing assembly. then i accessed each columns of that grid and did domething like this
grid1.columns[0].Header= rm.GetString("KEY_NAME_1");
grid1.columns[1].Header= rm.GetString("KEY_NAME_1");
and so on, i did not change anything in xaml file , above code behind will override the xaml code
this way column headers can be read from resource file
Hope this helps to many people having this issue.

Tags
GridView
Asked by
Ganesh
Top achievements
Rank 1
Answers by
Maya
Telerik team
Ganesh
Top achievements
Rank 1
Share this question
or