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

Sub Report not working

1 Answer 186 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Imed
Top achievements
Rank 1
Imed asked on 25 Aug 2011, 11:53 AM
Hello,
after upgrade the version of Telerik reporting Q2 2010 to Q1 2011 the report does not work

the report:

public partial class MasterReport : Telerik.Reporting.Report
    {
        public MasterReport()
        {
            InitializeComponent();
        }


        private void MasterReport_NeedDataSource(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
            // recupere la liste ID facture
            string[] idArray;
            idFactureArray = report.Parameters["List"].Value.ToString().Split(',');


            Telerik.Reporting.Drawing.Unit unitX = Telerik.Reporting.Drawing.Unit.Inch(0);
            Telerik.Reporting.Drawing.Unit unitY = Telerik.Reporting.Drawing.Unit.Inch(0);
            SizeU size = new SizeU(Telerik.Reporting.Drawing.Unit.Inch(1), Telerik.Reporting.Drawing.Unit.Inch(0.5));
            List<LettreRappel> detailReports = new List<LettreRappel>();
            LettreRappel detailReport1;
            // 
            for (int i = 0; i < idArray.Length; i++)
            {
                detailReport1 = new LettreRappel();
                detailReport1.ReportParameters["Id"].Value = idArray[i];
                detailReports.Add(detailReport1);
            }
         
            foreach (LettreRappel detailReport in detailReports)
            {
                SubReport subReport;
                subReport = new SubReport();
                subReport.Location = new PointU(unitX, unitY);
                subReport.Size = size;
                unitY = unitY.Add(Telerik.Reporting.Drawing.Unit.Inch(0.5));
                subReport.ReportSource = detailReport;
                detail.Items.Add(subReport);
                
            }


        }
    }

1 Answer, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 30 Aug 2011, 04:31 PM
Hi Imed,

Since Q3 2010 the NeedDataSource event is meant to be used only for providing data source to the report and this data source is cached unless changed i.e. once cached the NeedDataSource event is not fired again and as you probably know every time the report is previewed, paged or exported through the viewer it is processed and rendered from scratch. During this processing, the cached data source is used, but the other changes in NeedDataSource are not  being set as the event is not fired second time. That is why any other changes to the Report definition should be moved to the ItemDataBinding event, which is fired regardless.

If you experience further difficulties we will appreciate if you send us the exception and the stack trace.

All the best,
Peter
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
General Discussions
Asked by
Imed
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or