【问题标题】:Telerik reporting - unable to get report parametersTelerik 报告 - 无法获取报告参数
【发布时间】:2021-03-24 15:47:59
【问题描述】:

我有一个 .net 核心应用程序,其中有一个 Telerik 报告,它有两个参数

我有这样的代码

$("#summaryReport").click(function () {
                var viewer = $("#reportViewer1").data("telerik_ReportViewer");
                viewer.reportSource({
                    report: "Sumaren.trdp",
                    parameters: {}
                });
                viewer.refreshReport();
            });


            $("#reportViewer1")
                .telerik_ReportViewer({

                    serviceUrl: "api/reports/",

                    //ReportSource - report description
                    reportSource: {
                        // The report can be set to a report file name (trdx report definition)
                        // or CLR type name (report class definition).
                    },

                    viewMode: telerikReportViewer.ViewModes.INTERACTIVE,

                    scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,

                    scale: 1.0,
                    enableAccessibility: true,

                    ready: function () {
                        this.refreshReport();
                    },
                });

我不断收到错误Unable to get report parameters. Report 'ReportName' cannot be resolved. 我必须对reportSource 中的参数做些什么吗?我认为当您通过 Telerik Report Designer 添加参数时,除了报告名称之外,不要在 reportSource 中添加任何内容。Telerik Designer 可以很好地预览报告,工作正常,但是当我运行应用程序时只是一直说这个

【问题讨论】:

    标签: .net-core report telerik-reporting


    【解决方案1】:

    我参加聚会有点晚了,但会尝试回答 - 也许这对其他人有用。 由于您在设置 viewer.reportSource 时没有使用报告的绝对路径,因此引擎将在ReportServiceConfiguration 中指定的文件夹中搜索它。该配置应该在 Startup.cs 类中的某个位置注册,其中添加了 ReportsController 的依赖项。它应该看起来像这样:

    services.TryAddSingleton<IReportServiceConfiguration>(sp =>
    new ReportServiceConfiguration
    {
        ReportingEngineConfiguration = ConfigurationHelper.ResolveConfiguration(sp.GetService<IWebHostEnvironment>()),
        HostAppId = "ReportingCore3App",
        Storage = new FileStorage(),
        ReportSourceResolver = new UriReportSourceResolver(
            System.IO.Path.Combine(sp.GetService<IWebHostEnvironment>().ContentRootPath, "Reports"))
    });
    

    分配给 ReportSourceResolver 的值表示将如何解析报告。在这种情况下,它将在 \root\Reports 文件夹中查找报告,其中 root 是您的 .NET Core 应用程序的根文件夹。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-07
      • 2020-12-01
      • 2011-07-30
      • 2013-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多