views:

26

answers:

2

How do I go about providing localised text for items in a custom web control? I had thought that I just need to add meta.resourcekey tags to the control items and then define and fill some resource files called mycontrol.ascx.[lang].resx but that doesn't seem to work.

e.g.

MyControl.ascx

<asp:Label ID="Label1" meta:resourcekey="Label1" runat="server" Text="Oops!"></asp:Label>

MyControl.ascx.de.resx

Label1.Text    Donner und Blitzen!
A: 

you could use global resource files for this, here is a link that may help

derek
Thanks, but it made no difference...
paul
+1  A: 

You dont need to add meta tags.

Have this in your resource file (MyControl.ascx.de.resx) which will be located in App_LocalResources:

Name Value


SomeName Oops!

Then in your User Control:

<asp:Label ID="Label1" meta:resourcekey="Label1" runat="server">
    <%=GetLocalResourceObject("SomeName") %>
</asp:Label>

That helper method is part of the System.Web.UI.TemplateControl namespace.

RPM1984