如何本地化asp:TextBox's占位符,方法是读取App_LocalResources文件(.resx)

How to localized asp:TextBox's placeholder by reading App_LocalResources file (.resx)

本文关键字:App 读取 方法 LocalResources resx 文件 占位符 asp 本地化 TextBox      更新时间:2023-09-26

我有这样的控件:

<asp:TextBox  ID="txtEnrollMember" placeholder="Please Enter Your Name"  runat="server" />

如果当前页面的区域性="en-us",则占位符="Please Enter Your Name"

如果当前页面的区域性="zh-tw",则占位符="請輸入你的姓名"


我在谷歌上搜索了很长时间。但相关的解决方案很少。

我尝试过这样的解决方案,但没有成功。

如何在asp:textbox 中放置提示


想知道什么是最好的方法吗?

只需使用App_LocalResources。阅读特定语言的文本并设置翻译,例如从代码后面:

txtEnrollMember.Attributes["placeholder"] = "your transaltion";