Upgrade to 2017

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    3 posts
    Member since:
    Oct 2017

    Posted 24 Nov Link to this post

    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

     

     

  2. Katia
    Admin
    Katia avatar
    615 posts

    Posted 24 Nov Link to this post

    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
Back to Top