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

When are parameters resolved

3 Answers 169 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mitchell
Top achievements
Rank 1
Mitchell asked on 21 Aug 2015, 09:43 PM
I'm need to progromatically change some things ​in a report based on external conditions. I've created a non-visible parameter and I'm setting that parameter value from outside the report. However, I'm never seeing the parameter being set to anything but the default expression string from either the report constructor or the ItemDataBinding event. When in the cycle are report parameters bound to their values, and how can I hook into that?

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 26 Aug 2015, 12:17 PM
Mitchell,

To get the report parameter values passed from the viewer you need to use them in Expressions or access the processing report's Parameters collection. For more details check the Understanding Events and Using Report Events help articles.

Regards,
Nasko
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
0
Mitchell
Top achievements
Rank 1
answered on 26 Aug 2015, 05:31 PM

I'm still never seeing the actual values of the parameters. Let me be more specific. I need to know what a parameter value resolves to. However, whenever I peak at the ReportParameters collection, it is always just has the definition expression in the Value (in this case the string "= False"). How do I get the resolved value of the parameter?

   

public partial class BudgetBasicOcc2 : Telerik.Reporting.Report
 {
     public BudgetBasicOcc2()
     {
         //
         // Required for telerik Reporting designer support
         //
         InitializeComponent();
         //
         // TODO: Add any constructor code after InitializeComponent call
         //
         this.ItemDataBinding += BudgetBasicOcc2_ItemDataBinding;
         this.ItemDataBound += BudgetBasicOcc2_ItemDataBinding;
 
         this.reportHeader.ItemDataBinding += BudgetBasicOcc2_ItemDataBinding;
         this.reportHeader.ItemDataBound += BudgetBasicOcc2_ItemDataBinding;
     }
 
     void BudgetBasicOcc2_ItemDataBinding(object sender, EventArgs e)
     {
         var embedded = this.ReportParameters["Embedded"].Value;
         Console.WriteLine(embedded);
     }
 }

0
Nasko
Telerik team
answered on 31 Aug 2015, 08:24 AM
Hello Mitchell,

You are never seeing the actual values of the report parameters because you are using the report definition inside events. Using the report definition will always return the parameter values set in the report definition and not the actual ones.
You need to use the processing report object to review the parameter values:
private void Report1_NeedDataSource(object sender, EventArgs e)
{
    var report = (sender as Telerik.Reporting.Processing.Report);
    Console.WriteLine(report.Parameters["Parameter1"].Value.ToString());
}

Further information is also available in this help article.

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