【问题标题】:how to set meta tag dynamic from database in mvc如何在 mvc 中从数据库中动态设置元标记
【发布时间】:2015-02-09 23:01:31
【问题描述】:

ViewData["ChildPageMetaConent"] = lstPageMetaContentChilds; // 从这一行我从数据库中获取数据并设置为 ViewData。

示例:在ViewData["ChildPageMetaConent"] 中有列表类。您可以检查图像。

在 Master.cshtml 上,我正在访问 ViewData["ChildPageMetaConent"] 变量并开始写入 页面,但它像文本一样打印在页面上。

在 HTMl 上它看起来像这样:

【问题讨论】:

    标签: asp.net-mvc-4 razor model-view-controller


    【解决方案1】:

    我得到了答案。

    需要使用@Html.Raw(string)

    所以它会在页面上打印准确的 html 标签。

    【讨论】:

      猜你喜欢
      • 2019-09-13
      • 2016-11-24
      • 1970-01-01
      • 2017-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多