【问题标题】:Rendering as "&" in browser在浏览器中呈现为“&”
【发布时间】:2016-01-14 22:46:50
【问题描述】:

我正在使用以下代码:

@Html.Raw(HttpUtility.HtmlDecode(@expertTrckerReportTO.Name))

在输出字符串 "&" 上是 "&"。

有人可以帮忙吗?

Screen shot for reference

【问题讨论】:

  • 我无法复制您的问题。我已经尝试过类似:@Html.Raw("America & Vietnam") 在 .cshtml 中,但我仍然使用 '&' 得到了正确的结果。

标签: html asp.net-mvc ampersand


【解决方案1】:

您尝试过其中一种吗?

HTML 字符串:

@(new HtmlString(myString))

MvcHtmlString:

@MvcHtmlString.Create(myString)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-06
    • 2019-06-29
    • 2018-02-28
    相关资源
    最近更新 更多