This is a migrated thread and some comments may be shown as answers.

When are ReportParameters Values available when they are passed in?

1 Answer 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 22 Oct 2018, 09:27 PM

Have a class deriving from Telerik.Reporting.Report.  The report has parameters which have values being passed in.  They are being passed in because I can print out their values on the report.

But I would like to intercept their values at some point in the code to do something with them, but when referencing them they are all null.

Tried referencing them in the constructor of the report, as this.ReportParameters.

Tried adding event handlers to various events of the report object, as well as events of datasource objects within the report.  What event handler needs to be handled where the ReportParameters will be available when they are passed in from outside?

Passing in parameter values from HTML5 viewer using reportSource property as object value set to parameters.

1 Answer, 1 is accepted

Sort by
0
Ivan Hristov
Telerik team
answered on 25 Oct 2018, 11:22 AM
Hi Edward,

The report parameters from the viewer are being transferred to Telerik.Reporting.Processing.Parameter instances when the report processing is started, so each event that provides Telerik.Reporting.Processing.Report instance should suffice. For example, the following code snippet will output the parameter names and their values as they are set in the report viewer (not the default ones set in the Dashboard report definitions), which should be applicable to the current scenario:
public Dashboard()
{
    /// <summary>
    /// Required for Telerik Reporting designer support
    /// </summary>
    this.InitializeComponent();
    this.ItemDataBound += (s, e) =>
    {
        foreach (var p in ((Processing.Report)s).Parameters)
        {
            System.Diagnostics.Debug.WriteLine("{0} {1}", p.Key, ((Processing.Parameter)p.Value).Value);
        }
    };
}

Hope this helps.

Regards,
Ivan Hristov
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Edward
Top achievements
Rank 1
Answers by
Ivan Hristov
Telerik team
Share this question
or