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

Unable to find DetailSection using GetChildByNameetail sec

2 Answers 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Iris
Top achievements
Rank 1
Iris asked on 18 Dec 2012, 07:15 AM
EDIT: Sorry for the thread title, I only realized that I messed up the title after I posted the thread.

I need to get a value from volumeSumFunctionTextBox textbox in one of the subreports and display it in textBox1 in master report. My code is as attached below. But when I run this, detailSection will be null. Can anyone tell me what is wrong with my code?

private void textBox1_ItemDataBound(object sender, EventArgs e)
{
  Telerik.Reporting.Processing.TextBox textBox
    = (Telerik.Reporting.Processing.TextBox)sender;
  Telerik.Reporting.Processing.Report report = textBox.Report;
  Telerik.Reporting.Processing.DetailSection detailSection
    = Telerik.Reporting.Processing.DetailSection)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(report, "detail");
  Telerik.Reporting.Processing.SubReport subReportFuel
     = (Telerik.Reporting.Processing.SubReport)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(detailSection, "subReportFuel");
  Telerik.Reporting.Processing.TextBox subReportTextboxFuelVolume
     = (Telerik.Reporting.Processing.TextBox)Telerik.Reporting.Processing.ElementTreeHelper.GetChildByName(subReportFuel, "volumeSumFunctionTextBox");
 
  textBox.Value = subReportTextboxFuelVolume.Value;
}

Secondly, the master report's ReportParameters allows MultiValue. Therefore I'll need to display the sum of all values in volumeSumFunctionTextBox in textBox1. Which section of the report should I put textBox1? I've tried putting textBox1 in reportFooter but the textBox will not be displayed if I select more that than one value for ReportParameters .

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Massimiliano Bassili
Top achievements
Rank 1
answered on 18 Dec 2012, 01:35 PM
The detail section name is 'detail' by default, so unless you have changed it manually, you should use detail as first argument. Additionally your scenario is reverse to normal, where subreports are used to display detail data, not the other way around. I would suggest revising your user case and probably modify your data prior to databinding, so the data you want to get is part of the master report data source.

Cheers!
0
Iris
Top achievements
Rank 1
answered on 16 Jan 2013, 03:47 AM
I've checked but the detail section name is 'detail'.

Thank you for your advise, I've changed my report structure such that the master report is independent of it subreports, hence I don't need to solve the problem with the missing reference to the detail section of the sub report. Thank you once again for your advice on the correct practice for reporting.
Tags
General Discussions
Asked by
Iris
Top achievements
Rank 1
Answers by
Massimiliano Bassili
Top achievements
Rank 1
Iris
Top achievements
Rank 1
Share this question
or