c# - 在 ajax ActionLinks 中使用 ×

标签 c# razor

我正在尝试使用 html 特殊字符 ×显示 ×。

在我的 Razor View 中使用以下代码

@Ajax.ActionLink("×", "LogTable", "Log", null, null, null)

但是上面的内容不能识别 ×作为一个特殊字符,而不是作为一个字符串,它显示 ×而不是×。有没有一种特定的方法来逃避它,所以它的工作原理如下

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
        &times;
</button>

谢谢

最佳答案

您应该使用HttpUtility.HtmlDecode功能:

@Ajax.ActionLink(HttpUtility.HtmlDecode("&times;"), "LogTable", "Log", null, null, null)

关于c# - 在 ajax ActionLinks 中使用 ×,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27980606/

相关文章:

c# - 调用 XmlWriter.WriteElementString 时防止字符转义

c# - 将 URI 路径转换为 ​​.NET 中的相对文件系统路径

c# - 在运行时更改数据透视表头

asp.net-mvc - 页面加载时显示 MVC-5 Razor 验证错误

asp.net - 如何结合 ASP MVC 5 和 Emberjs

c# - 网络核心 DbContextPool 与 AddDbContextPool 等

c# - 无法解析为有效的类型或函数

css - 验证失败时如何将 css 添加到单个 mvc Helper 方法 - 从模型内部

html - 如何允许屏幕阅读器在错误地将焦点移动到字段时宣布 ASP.NET MVC 5 表单验证消息?

javascript - Javascript 中如何检查是否只有一个值不为空?