Articles in this section
Category / Section

How to Pass Parameters from the Server Side

Published:
Updated:

Parameters are used to interactively provide user inputs at runtime to vary the report presentation based on it. Parameters can also be used in expressions to control report data. It provides property options to pass or set default values for report parameters at runtime using the parameters property. You can set the report parameters while creating the Report Viewer control in a script or in the Web API Controller.

To pass parameters from server-side frameworks like Core, MVC, and Webforms, use the following code in the Report viewer Web API Controller OnReportLoaded method.

[NonAction]
public void OnReportLoaded(ReportViewerOptions reportOption)
{
    List<BoldReports.Web.ReportParameter> userParameters = new List<BoldReports.Web.ReportParameter>();
    userParameters.Add(new BoldReports.Web.ReportParameter()
    {
        Name = "SalesOrderNumber",
        Values = new List<string>() { "SO50756" }
    });
    reportOption.ReportModel.Parameters = userParameters;
}

For more information, you can refer to the Set Parameters in Web API Controller section.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied