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".

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.