views:

1080

answers:

1

Im having a problem with the HeaderText not being translated when i have definied a new resource file.. all other text do translate but not the HeaderText, even the TemplateField.HeaderText gets translated.

<asp:GridView ID="GridView1" runat="server"
    PageSize="25" GridLines="None" 
    AutoGenerateColumns="False" Width="100%" 
    meta:resourcekey="GridView1Resource1">
    <AlternatingRowStyle CssClass="alt" />
    <Columns>
        <asp:BoundField DataField="Title" HeaderText="Title" 
            meta:resourcekey="BoundFieldResource1" />
        <asp:BoundField DataField="Created" HeaderText="Skapad" 
            meta:resourcekey="BoundFieldResource2" />
        <asp:BoundField DataField="CreatedBy" HeaderText="Skapad av" 
            meta:resourcekey="BoundFieldResource3" />
        <asp:TemplateField HeaderText="Till" meta:resourcekey="TemplateFieldResource1">
            <ItemTemplate>
                <asp:Label ID="lblTo" runat="server" Text="Till" 
                    meta:resourcekey="lblToResource1" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField meta:resourcekey="TemplateFieldResource2">
            <ItemTemplate>
                <asp:HyperLink ID="hplPopup" runat="server" Text="Öppna" 
                    meta:resourcekey="hplPopupResource1"></asp:HyperLink>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <FooterStyle CssClass="foot" />
    <PagerStyle CssClass="pager" />
    <SelectedRowStyle CssClass="selected" />
</asp:GridView>
+1  A: 

You could do something like this, where TitleHeaderText would be the name of the resource (example code, untested):

<asp:BoundField DataField="Title" HeaderText="<%$ Resources:TitleHeaderText %>" 
        meta:resourcekey="BoundFieldResource1" />

Here's an explaination of how to access web page resources.

CAbbott