ASPX templates
Version 6.x > ASPX templates > How to escape quotes in string ? View modes: 
User avatar
Member
Member
jacques.honore-gmail - 4/19/2012 5:27:06 AM
   
How to escape quotes in string ?
Hi,

Within a template I just want to know how it is possible to escape quotes within strings?

I am trying to conditionnaly print some HTML code:

<%# IfEmpty(Eval("EventFlyer"), "", "<span class="test">TEST</span>" %>

Thanks for the support.
Jacques

User avatar
Kentico Support
Kentico Support
kentico_janh - 4/19/2012 5:34:54 AM
   
RE:How to escape quotes in string ?
Hello,

You dont have to escape anything, because HTML doesn't make difference between quotes and apostrophes, so you can write just:

<%# IfEmpty(Eval("EventFlyer"), "", "<span class='test'>TEST</span>" %>


Best regards,
Jan Hermann

User avatar
Member
Member
jacques.honore-gmail - 4/20/2012 5:50:30 AM
   
RE:How to escape quotes in string ?
Great I didn't know that and it is working nicely!
Thanks for the support.