简体   繁体   English

在剃刀视图中显示格式化的html

[英]display formatted html inside razor view

I'm loading from database certain property which holds formatted html. 我正在从数据库加载包含格式化html的某些属性。 Inside razor view I'm loading property using razor helper 在剃须刀视图内部,我正在使用剃须刀助手加载属性

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

but that renders this formatted html like 但这使此格式化的html像

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

what I want is to use this html tags and display formatted like 我想要的是使用此html标记并以类似格式显示

some text, sometext 

**more bolded text**

You need a different method or the HTML will be interpreted. 您需要使用其他方法,否则将解释HTML。 Use @Html.Raw(Model.Description). 使用@ Html.Raw(Model.Description)。 This should write out the HTML. 这应该写出HTML。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM