Question

I try to use Kentico CMS helper in textbox placeholder tag in ASP.NET but it doesn't work. When I tried to compile it I obtained error:"The name txtPassword does not exist in current context".

Could you explain why I can't use it that way? How can I do it?

<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" placeholder="'<%# CMS.GlobalHelper.ResHelper.GetString("Account.Password") %>'" AutoCompleteType="None"></asp:TextBox>
Was it helpful?

Solution

Assuming you're on a data bind control context try with this

placeholder='<%# CMS.GlobalHelper.ResHelper.GetString("Account.Password") %>'

Notice I've removed the outer "

if you're not on a data bind context, replace # by =

placeholder='<%= CMS.GlobalHelper.ResHelper.GetString("Account.Password") %>'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top