开发者

Quote marks in controls' property in ASP.NET markup

Sounds dummy but I can't set to a server-side control's property a value contains quote marks ":

<asp:CompareVa开发者_运维技巧lidator ErrorMessage="Currency-from can't be equal to currency-to" runat="server"  />

I need to quote "from" and "to".

I tried escaping \"from\" and double quote marks ""from"" - both doesn't work. How to do that?


You could just use single quotes.

Or replace the double quotes with "&quot ;" (without the space between the t and semi-colon)


Single quotes won't work because you also have a single quote on the text


You can do it using &quot; for quotes, this is how you escape them in HTML, like this:

<asp:CompareValidator runat="server" ErrorMessage="Currency &quot;from&quot; can't be equal to currency &quot;to&quot;" />

(Also, fix the first spelling or Currency!)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜