开发者

How can I create a custom control that will change its values (or load the values) based on the language selected?

Basically, my user control has a label in it and I expose the Text of the label through a property, however when I change the value in UI editor it changes th开发者_Python百科e value for all languages, and does not place it into the resx class. Is there an Attribute or something I need to place on the property to state that it should read/save its value to the .resx file?


As i understood you dont know how to use resources in ASP.NET. So create folder "App_LocalResources" in the same folder as control, and add resx files with values for each locale that you need.

/App_LocalResources/CustomControl.ascx.resx (Hello - Hello)

/App_LocalResources/CustomControl.ascx.de.resx (Hello - Hallo)

CustomControl.ascx :

<asp:Label ID="Label2" runat="server" Text="<%$Resources:Hello%>"></asp:Label>


Found my own answer need to add Localizable(true)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜