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

Upgrade to 2017

1 Answer 13 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 24 Nov 2017, 07:07 AM

I have a problem after upgrade my project from Q1 2014 to Lasr version 2017 of telerik components and reporting. I solved the problems at the all components but at Reporting still have problems and i don't know why.

 

I have few reports which contain 2-3 subreports. After upgrade my parameters on NeedDataSource has value 0. but on sender the value is ok.

I tried few methods to extract the value but only one works.

    Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;<br>           
    string idUser = report.Parameters["idUser"].Value.ToString(); <br>           
    this.llDs.DataSource = new Service().GetLLGridModel((int.Parse(idUser)));

If i put: int idUser = report.Parameters["idUser"].Value or int.Parse(this.ReportParameters["idUser"]).Value.ToString()).  the value will be 0 I don't understand why?

 

Any other solutions? because my solution it's a trick but not clean code. i made cast to string to extract a value from object and then cast from string to int to pass to function...

Thank you

 

 

1 Answer, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 24 Nov 2017, 01:36 PM
Hi Daniel,

There was a change in R3 2016 release in how each definition item property values are read and cached (that was an optimization change). For more details please check Changes on items in report events are not applied KB article.

If you change the item definitions inside events those changes will no longer be applied. The correct approach is to get the processing item - examples are provided the above mentioned article and Report Events section.

Here the value of parameter should be valid as you are accessing the processing report:
Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
string idUser = report.Parameters["idUser"].Value.ToString();

However, accessing the parameter of the report definition (using this keyword) will no longer work:
int.Parse(this.ReportParameters["idUser"]).Value.ToString())

Setting the data source for the data item definition won't work as well:
this.llDs.DataSource = new Service().GetLLGridModel((int.Parse(idUser)));

To access the inner data item you can use ElementTreeHelper Methods.

I hope this information will help.


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