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 "" ;"
(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 "
for quotes, this is how you escape them in HTML, like this:
<asp:CompareValidator runat="server" ErrorMessage="Currency "from" can't be equal to currency "to"" />
(Also, fix the first spelling or Currency!)
精彩评论