引号

2010-05-16 50 views
1

听起来很虚,但我不能设置一个服务器端控件的属性值包含引号"引号

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

我需要‘从’引述并”。

我试过转义\"from\"和双引号""from"" - 两者都不起作用。怎么做?

回答

3

单引号不会起作用,因为你还必须在文本上单引号

4

您可以使用单引号。

或者更换"&quot ;"双引号(不含T和分号之间的空间)

+0

使用类似'ErrorMessage =“Currency”from“的单引号不能是..”'不起作用 – abatishchev 2010-05-16 19:04:18

+0

我的意思是不像'ErrorMessage ='Currency'from'can not be ..“' - 但我会按照每个人的建议使用'"'。 – 2010-05-16 20:13:10

3

你可以做到这一点使用&quot;行情,this is how you escape them in HTML,像这样:

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

(另外,修复第一个拼写或货币!)