【问题标题】:display formatted html inside razor view在剃刀视图中显示格式化的 html
【发布时间】:2015-05-16 19:53:32
【问题描述】:

我正在从数据库中加载某个包含格式化 html 的属性。在 razor 视图中,我正在使用 razor helper 加载属性

  @Html.DisplayFor(model => model.Description)

但是这样会呈现这种格式化的 html

some text, sometext <br><br> <b>more bolded text</b>

我想要的是使用这个html标签并显示格式像

some text, sometext 

**more bolded text**

【问题讨论】:

    标签: c# html asp.net-mvc


    【解决方案1】:

    您需要不同的方法,否则 HTML 将被解释。使用@Html.Raw(Model.Description)。这应该写出 HTML。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-29
      • 1970-01-01
      • 2017-09-12
      • 1970-01-01
      相关资源
      最近更新 更多