This is a migrated thread and some comments may be shown as answers.

Unable to get report parameters. An error has occurred. Object reference not set to an instance of an object.

1 Answer 65 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 14 Dec 2020, 06:42 PM

Hello, I am getting:

    "Unable to get report parameters.
    An error has occurred.
    Object reference not set to an instance of an object."

when trying to load a report into the HTML5 report viewer.

Code snippets below - resolve nevere gets called, but the payload of the POST looks correct.  Any ideas?

 

<script type="text/javascript">
    $(document).ready(function () {
            $("#reportViewer1")
                .telerik_ReportViewer({
                    // The URL of the service which will serve reports.
                    // The URL corresponds to the name of the controller class (ReportsController).
                    // For more information on how to configure the service please check http://www.telerik.com/help/reporting/telerik-reporting-rest-conception.html.
                    serviceUrl: "/reportdata/",
 
                    // The URL for the report viewer template. The template can be edited -
                    // new functionalities can be added and unneeded ones can be removed.
                    // For more information please check http://www.telerik.com/help/reporting/html5-report-viewer-templates.html.
                    // templateUrl: 'ReportViewer/templates/telerikReportViewerTemplate.html',
 
                    //ReportSource - report description
                    reportSource: {
 
                        // The report can be set to a report file name (.trdx or .trdp report definition)
                        // or CLR type name (report class definition).
                        report: { reportId: 89 },
 
                        // Parameters name value dictionary
                        parameters: { foo: 1}
                    },
 
 
 
                    //parameters: {
                    //    editors: {
                    //        singleSelect: telerikReportViewer.ParameterEditorTypes.COMBO_BOX,
                    //        multiSelect: telerikReportViewer.ParameterEditorTypes.COMBO_BOX,
                    //    }
                    //},
 
                    // Specifies whether the viewer is in interactive or print preview mode.
                    // PRINT_PREVIEW - Displays the paginated report as if it is printed on paper. Interactivity is not enabled.
                    // INTERACTIVE - Displays the report in its original width and height without paging. Additionally interactivity is enabled.
                    viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
 
                    // Sets the scale mode of the viewer.
                    // Three modes exist currently:
                    // FIT_PAGE - The whole report will fit on the page (will zoom in or out), regardless of its width and height.
                    // FIT_PAGE_WIDTH - The report will be zoomed in or out so that the width of the screen and the width of the report match.
                    // SPECIFIC - Uses the scale to zoom in and out the report.
                    scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
 
                    // Zoom in and out the report using the scale
                    // 1.0 is equal to 100%, i.e. the original size of the report
                    scale: 1.0,
 
                    //Enables or disables the accessibility features of the report viewer and its contents.
                    enableAccessibility: false,
 
                    //If set to true shows the Send Mail Message toolbar button
                    sendEmail: { enabled: true }
                });
 
    });
    </script>

 

public class ReportSourceResolver : IReportSourceResolver
    {
        private string _reportDbConnectionString;
 
 
        public ReportSourceResolver(string reportDbConnectionString)
        {
            _reportDbConnectionString = reportDbConnectionString;
        }
 
        public Telerik.Reporting.ReportSource Resolve(string reportId,OperationOrigin operationOrigin, IDictionary<string, object> currentParameterValues)
        {
 
            sproc_ReportDetailsXMLGet_Wrapper.In_Type inparams = new sproc_ReportDetailsXMLGet_Wrapper.In_Type()
            {
                ReportId = reportId.ToNullableInt(),
            };
 
            var sp = new sproc_ReportDetailsXMLGet_Wrapper(inparams);
            _ = ReportingDB.ExecOn(_reportDbConnectionString).SpCall(sp);
 
            var outrecord = sp.Out.Records[0];
            return new Telerik.Reporting.XmlReportSource { Xml = outrecord.SerializedReport };
        }
    }
}

 

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 17 Dec 2020, 03:59 PM

Hello James,

I am sorry to hear that you experience an issue with our product.

I will need more information about the project's scenario and the purpose of the custom report resolver. Also, to be able to investigate further, can you please send us the trace log generated after attaching Trace Listener and the SAZ file created by Fiddler?

I will be looking forward to receiving an update from you.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
James
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or