如何在 Razor Pages 中显示 FastReport

问题描述 投票:0回答:1

我正在使用 Razor Pages 网络应用程序 .Net Core 6。 我有一份报告(FastReport),我想在页面上显示。

代码如下: `

using FastReport.Report report = new ();
        var reportPath = _env.WebRootFileProvider.GetFileInfo("Reports/ConsumerStatement.frx")?.PhysicalPath;
        report.Load(reportPath);
        report.RegisterData(data, "RefData");` 

一切正常。在 .Net Core MVC 报告中成功显示: `返回视图(报告);

但我不知道如何在 Razor Pages 中显示此报告,因为 return Page() 不接受任何参数。

如何在剃须刀页面中显示此报告??

asp.net-core fastreport
1个回答
0
投票

尝试使用 ViewBag/ViewData 作为 FastReportdoc

将值传递给 razor 视图

在页面模型中:

ViewBag.Report=report;

在 RazorView 中:

@ViewBag.Report.......
© www.soinside.com 2019 - 2024. All rights reserved.