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.