0

I have the following:

<h1><asp:Literal runat="server" Text="<%$ Localize:LoginRequest %>"/></h1>

<fieldset>
    <legend></legend>

    <input runat="server" class="form-control" placeholder="E-mail" type="text" />
    <input runat="server" class="form-control" placeholder="Password" name="password" type="password" value="" />

    <button runat="server" type="submit" class="btn btn-default"><asp:Literal runat="server" Text="<%$ Localize:Submit %>"/></button>

</fieldset>

Localize is a custom expression builder to translate my strings from a resource file. I would like to do the same for the placeholder attribute. I know I can do this server-side, but I would like to have a similar method. Is there any available?

I know I could use:

<input class="form-control" placeholder="<%= GetString("Email") %>" type="text" />

but then I cannot use runat="server".

Edited by pritaeas

2
Contributors
2
Replies
29
Views
2 Years
Discussion Span
Last Post by pritaeas
0

By using runat="server" at your <input></input> tags you are actually making the server side controls. So, providing, that you have set up correctly your global localization files you can use placeholder="<$ Resources:Localize, txtvariable %>" to do the job.
Haven't try it yet inside your code be logically it has to work.

0

By using runat="server" at your <input></input> tags you are actually making the server side controls.

I tried that, but then the Visual Studio editor complained about not recognizing the placeholder attribute.

I recently switched to VS2013 and haven't tested it again. It was a problem in VS2012.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.