简体   繁体   English

在asp.net中传递双引号

[英]Passing Double Quotes in asp.net

My web app requires double quotes to be passed within the dropdownlist for the ListItem Value property because a few of the database names begin with numbers.我的 Web 应用程序需要在 ListItem Value 属性的下拉列表中传递双引号,因为一些数据库名称以数字开头。 Is this possible?这可能吗?

I tried "\\"123db\\"" and getting this error "this attribute name must be followed by an equal..."我尝试了“\\”123db\\””并收到此错误“此属性名称必须后跟一个相等的...”

<asp:ListItem Value="123db">123db</asp:ListItem>

Thanks谢谢

Try this:尝试这个:

<asp:ListItem Value="&quot;123db&quot;">123db</asp:ListItem>

Since't it's HTML that get's rendered in the end of the day.因为它不是在一天结束时呈现的 HTML。

However, I would advise strongly not to include quotes in your value - value should be a programmatic string, and " is not a valid character in it.但是,我强烈建议不要在您的值中包含引号- 值应该是一个编程字符串,并且 " 不是其中的有效字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM