Skip to main content
 首页 » 编程设计

c#之如何在aspx页面的标签控件中显示 `&`

2024年02月23日17落叶无声

如何在 aspx 页面的标签或文本框中显示文本 "Replace & with &"?当我在 aspx 页面中放置 Text="Replace & with &" 时,我得到的输出为“Replace & with &”

请您参考如下方法:

使用 HttpUtility.HtmlEncode("&");这始终有效,并且生成的代码更具可读性。