【问题标题】:List Elements (li) not rendering using @Html.Raw列表元素 (li) 不使用 @Html.Raw 呈现
【发布时间】:2022-06-10 22:30:41
【问题描述】:

我有一个包含带有 li 元素的 html 的数据库字段,并且我正在使用 @Html.Raw 并且除 li 元素之外的所有内容都正确呈现。

这是来自我的 ASP.NET MVC 网站的代码。

<div class="col-xs-12">
      @if (!String.IsNullOrEmpty(Model.ProductMetadataDTO.CoreProduct.MainDescription))
      {
           <h5><strong>Overview</strong></h5>
           <span class="more">@Html.Raw(Model.ProductMetadataDTO.CoreProduct.MainDescription)/span>
      }
      @if (!String.IsNullOrEmpty(Model.ProductMetadataDTO.CoreProduct.ContributorBiography))
      {
           <h5><strong>Author Bio</strong></h5>
           <span class="more">@Html.Raw(Model.ProductMetadataDTO.CoreProduct.ContributorBiography)</span>
      }
</div>

我在 CoreProduct.MainDescription 所在的行上放了一个断点,然后将鼠标悬停在它上面并单击 HTML Visualizer,它看起来正确,项目符号点按预期呈现。

但这是我点击继续时浏览器中显示的内容。

我尝试了多个选项,但无法正确渲染。任何建议表示赞赏。

【问题讨论】:

  • 看起来您可能有一个自定义样式,它以这种方式为您的列表元素设置样式。你检查过你的 CSS 吗?

标签: html asp.net-mvc


猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-30
  • 2012-10-20
  • 2011-11-19
  • 1970-01-01
  • 2023-03-09
  • 1970-01-01
相关资源
最近更新 更多