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

How to get report parameters in default constructor

1 Answer 246 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 12 Sep 2019, 04:28 AM

Does anyone know how to get the value of report parameters in the default report constructor? I am using Telerik.ReportViewer.Html5.WebForms. You used to be able to get it by the example below but this no longer works. Is there another way to get a reference to a parameter within the default constructor?

 

    public partial class Report1 : Telerik.Reporting.Report
    {
        public Report1(int month)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

 

           int MonthParam = month;
        }
    }

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 16 Sep 2019, 01:14 PM

Hi Terry,

If I understood correctly, you would like to set the value of the report parameter through the report's constructor. Note that the report needs to have a parameterless constructor in order to be opened in the Visual Studio designer or passed to the TypeReportSource.

If you need to pass the parameter in the report constructor, you will have to wrap it in an InstanceReportSource when passing it to the Reporting engine. Note that we recommend to use Report with a parameterless constructor and pass the Report Parameter values through the Parameters collection of the Report Source.

Regards,
Neli
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
Terry
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or