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 };
}
}
}