控件中的引号 ASP.NET 标记中的属性

发布于 2024-09-01 09:34:29 字数 294 浏览 2 评论 0原文

听起来很假,但我无法将包含引号 " 的值设置为服务器端控件的属性:

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

那伤。 2024-09-08 09:34:29

您可以只使用单引号。

或者将双引号替换为 "" ;" (t 和分号之间没有空格)

You could just use single quotes.

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

我喜欢麦丽素 2024-09-08 09:34:29

单引号不起作用,因为文本上也有单引号

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

极度宠爱 2024-09-08 09:34:29

您可以使用 " 进行引用,这就是方法您可以在 HTML 中转义它们,如下所示:(

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

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

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!)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文