引號

2010-05-16 54 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;" /> 

(另外,修復第一個拼寫或貨幣!)