控件中的引号 ASP.NET 标记中的属性
听起来很假,但我无法将包含引号 "
的值设置为服务器端控件的属性:
<asp:CompareValidator ErrorMessage="Currency-from can't be equal to currency-to" runat="server" />
我需要引用“from”和“to”。
我尝试转义 \"from \"
和双引号 ""from""
- 两者都不起作用。如何做到这一点?
Sounds dummy but I can't set to a server-side control's property a value contains quote marks "
:
<asp:CompareValidator 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以只使用单引号。
或者将双引号替换为
"" ;"
(t 和分号之间没有空格)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
您可以使用
"
进行引用,这就是方法您可以在 HTML 中转义它们,如下所示:(另外,请修复第一个拼写或货币!)
You can do it using
"
for quotes, this is how you escape them in HTML, like this:(Also, fix the first spelling or Currency!)