IReportController
The IReportController interface declares the Web API controller action methods that process RDL, RDLC, and SSRS reports and handle requests from the Bold Reports® JavaScript Report Viewer. The IReportController declares the following action methods.
| Methods | Description |
|---|---|
| GetResource | Action (HttpGet) method for getting resource for report. |
| PostReportAction | Action (HttpPost) method for posting the request for report process. |
| OnInitReportOptions | Report initialization method that is triggered when report begins to be processed. |
| OnReportLoaded | Report loaded method that is triggered when report and sub report begin loading. |
ReportHelper
The ReportHelper class contains helper methods that process Post or Get requests from the Report Viewer control and return the response to the Report Viewer control. The ReportHelper class has the following methods.
| Methods | Description |
|---|---|
| GetResource | Returns the report resource for the requested key. |
| ProcessReport | Processes the report request and returns the result. |
public class ReportsController: ApiController,IReportController
{
/// <summary>
/// Action (HttpGet) method for getting resource for report.
/// </summary>
/// <param name="key">The unique key to get the required resource.</param>
/// <param name="resourceType">The type of the requested resource.</param>
/// <param name="isPrinting">If set to <see langword="true"/>, then the resource is generated for printing.</param>
/// <returns>The object data.</returns>
public object GetResource(string key, string resourcetype, bool isPrint)
{
//Returns the report resource for the requested key.
return ReportHelper.GetResource(key, resourcetype, isPrint);
}
/// <summary>
/// Report Initialization method that is triggered when report begin processed.
/// </summary>
/// <param name="reportOptions">The ReportViewer options.</param>
[NonAction]
public void OnInitReportOptions(ReportViewerOptions reportOptions)
{
//You can update report options here
}
/// <summary>
/// Report loaded method that is triggered when report and sub report begins to be loaded.
/// </summary>
/// <param name="reportOptions">The ReportViewer options.</param>
[NonAction]
public void OnReportLoaded(ReportViewerOptions reportOptions)
{
//You can update report options here
}
/// <summary>
/// Action (HttpPost) method for posting the request for report process.
/// </summary>
/// <param name="jsonData">The JSON data posted for processing report.</param>
/// <returns>The object data.</returns>
public object PostReportAction(Dictionary < string, object > jsonData)
{
//Processes the report request and returns the result.
return ReportHelper.ProcessReport(jsonData, this);
}
}