We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

KeyNotFound in ProcessReport

Thread ID:

Created:

Updated:

Platform:

Replies:

143438 Mar 20,2019 10:27 AM UTC Mar 21,2019 08:58 AM UTC JavaScript 1
loading
Tags: ejReportViewer
Neil Abela
Asked On March 20, 2019 10:27 AM UTC

I am trying to generate a report based on the samples but I keep getting the below exception 

Sf_Exception - System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Syncfusion.EJ.ReportViewer.Internal.ReportViewerInternalHelper.ProcessReport()

I am calling it like this in the view

<script type="text/javascript">
    $(function () {
        $("#container").ejReportViewer(
            {
                reportServiceUrl: "api/ReportApi",
                processingMode: ej.ReportViewer.ProcessingMode.Local,
                reportPath: "~/App_Data/Report1.rdlc"
            });
    });
</script>

and in the Web API controller I have this

  [HttpPost]
        public object PostReportAction(Dictionary<string, object> jsonResult)
        {
            return ReportHelper.ProcessReport(jsonResult, this);
        }

        //Get action for getting resources from the report
        [System.Web.Http.ActionName("GetResource")]
        [AcceptVerbs("GET")]
        public object GetResource(string key, string resourcetype, bool isPrint)
        {
            return ReportHelper.GetResource(key, resourcetype, isPrint);
        }

        //Method will be called when initialize the report options before start processing the report        
        public void OnInitReportOptions(ReportViewerOptions reportOption)
        {

        }

        //Method will be called when reported is loaded
        public void OnReportLoaded(ReportViewerOptions reportOption)
        {
            reportOption.ReportModel.ProcessingMode = ProcessingMode.Local;
            reportOption.ReportModel.ReportPath = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/Report1.rdlc");
            reportOption.ReportModel.DataSources.Clear();
            reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "Sales", Value = OrderReportModel.GetData() });
        }
    }


I have also set the license key in the Global.asax.

When I debug the program, I am succesful in reaching the PostReportAction method but it returns the above KeyNotFound exception.

Can you please tell me what Key is being used that I am missing?

Thanks.



Mageshyadav M [Syncfusion]
Replied On March 21, 2019 08:58 AM UTC

Hi Neil, 
 
Thanks for your interest in our Syncfusion product. 
 
We were unable to reproduce the mentioned key not found issue when loading the RDLC report in report viewer. So we have prepared the simple sample to load the RDLC report in web report viewer. Could you please confirm whether the below attached sample is working or not at your end. 
 
If issue still persists then could you please revert the above sample with issue reproducible case to validate the mentioned problem at our end. 
 
Regards, 
Mageshyadav.M 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;