Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
1 like 0 dislike
in .Net Framework by 5 5 8

I am trying to show a placeholder in ASP.NET textbox control to show a hint for the user that added sccuddfully as answerd at How to add placeholder in ASP.NET Textbox. but now I need to know How can I show dynamic hint placeholder from Resources.resx file based on the current site language?

belwo I need to show the placeholder hint text in another language based on my resourcefile.resx, How to do that?

Dynamic placeholder from resources file in ASP.NET

1 Answer

2 like 0 dislike
by 155 174 353
selected by
Best answer

Showing Dynamic Placeholder from Resource file in APS.NET

You can show the placholder attribute value from a resource file using <%$Resources:ResourceFile,Title%> as below:

<asp:TextBox CssClass="form-control" ID="txt_name" placeholder="<%$Resources:ResourceFile,Title%>" runat="server"></asp:TextBox>

Additionally, you can set the placeholder attribute in a code-behind using C# as below

txt_name.Attributes["placeholder"] =  YourResource_fileName.ResourceManager.GetString("Resource Key");
by 5 5 8
0 0
it's worked for me, thanks!
If you don’t ask, the answer is always NO!