【问题标题】:mvc3 - How to disable htmlencode of symbols from sourcemvc3 - 如何从源代码中禁用符号的 htmlencode
【发布时间】:2011-06-26 02:23:28
【问题描述】:

我需要从数据库表中取出我的页面文本。表格字段“文本”包含带有 html 格式标记的文本,例如 <p>, <br/> 等...(在表格中未编码!)

当我尝试使用 @Model.Text 进行输出时,我看到了编码的 html 标签,例如 <p> 如何禁用此 html 编码。 谢谢。

【问题讨论】:

    标签: asp.net-mvc-3 html-encode


    【解决方案1】:

    您可以使用@Html.Raw(Model.Text) 来实现此目的。

    【讨论】:

    • 我喜欢简短回答令人沮丧的问题。
    • nop 对我不起作用,它给出了

      包含?请帮忙
    【解决方案2】:
    猜你喜欢
    • 2018-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-25
    • 1970-01-01
    相关资源
    最近更新 更多