Вопрос

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>
Это было полезно?

Решение

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") %>'
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top