【问题标题】:Razor Layout is missing缺少剃刀布局
【发布时间】:2017-02-20 19:04:51
【问题描述】:

为什么这个页面不显示布局或 ViewBag.Title? “MyChart”渲染正常,但是当调用“Write”函数时,它会将所有页面内容替换为渲染图像。有没有办法在渲染图像之后或之前向页面添加更多内容?

@model cmCase.Models.xyz

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>

<div class="well">
    @{
        var myChart = new Chart(width: 1000, height: 400, theme: ChartTheme.Green)
            .AddTitle("Most Popular")
            .AddSeries(name: "Employee", xValue: new[] { "Peter", "Andrew", "Julie", "Mary", "Dave" },  yValues: new[] { "2", "6", "4", "5", "3" })
            .AddSeries(name: "Employee12", xValue: new[] { "Peter", "Andrew", "Julie", "Mary", "Dave" },yValues: new[] { "2", "6", "4", "5", "3" })                    
            .Write();
    }
</div>

【问题讨论】:

    标签: c# asp.net asp.net-mvc-4 razor


    【解决方案1】:

    好的,看起来这需要两个步骤。

    "第一步是创建一个生成图表的页面"

    "第二步,将生成的图像显示在另一个页面中。"

    如此处所述using charts in razor

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-04
      • 1970-01-01
      • 2013-01-24
      • 2020-08-11
      • 1970-01-01
      • 2012-06-12
      • 2015-07-22
      相关资源
      最近更新 更多