简体   繁体   English

如何通过读取App_LocalResources文件(.resx)来本地化asp:TextBox的占位符

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

I have a controls like this : 我有一个这样的控件:

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

If current page's culture = "en-us" then the placeholder = "Please Enter Your Name" 如果当前页面的文化= "en-us"则占位符= "Please Enter Your Name"

If current page's culture = "zh-tw" then the placeholder = "請輸入你的姓名" 如果当前页面的区域性= "zh-tw"则占位符= "請輸入你的姓名"


I am searching for a long time on google. 我在Google上搜索了很长时间。 But the related solutions is very few. 但是相关的解决方案很少。

I've tried the solutions like this but not work. 我已经尝试过像这样的解决方案,但是没有用。

How do I put hint in a asp:textbox 如何在asp:textbox中放置提示


Wanted to know what would be the best way to do that? 想知道什么是最好的方法吗?

Simply use the App_LocalResources. 只需使用App_LocalResources。 Read the text for specific language and set the translation eg from code behind: 阅读特定语言的文本并设置翻译,例如从后面的代码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM