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

table in detail section of subreport not working

2 Answers 28 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 08 Mar 2017, 01:45 AM

Hello,

 

I have a table in the detail section of a subreport, so it should recurr for each element in the bound datasource (in this case objectives).  SO there shoudl be one talb eper objective. The report was working fine and then stopped after upgrading to the most recent version.  I'm wondering if there is a recommended way to do what I am doing...  See capture.png

Essentially for each objective, I want to display the result in a table, because the text of each attribute is long and the table will expand appropriately to display the item.  The Goal number in green displays correctly, however the attributes such as Area of desired change are blank..

I've tried setting the textboxes in the table directly on the itemdatabound event of the detail section (see commented text below) and this does work but if there are three objectives it sets all three instances of the table textboxes rather than the current detail section (and table) only. I've also tried the NeedDataSource of the table...  what is the best way to go about this?

private void TelerikRptTreatmentPlanSub_NeedDataSource(object sender, EventArgs e)
{
    (sender as Telerik.Reporting.Processing.Report).DataSource = ObjectiveService.GetForTreatmentPlan(this.Parameter1);
}
 
private void detail_ItemDataBinding(object sender, EventArgs e)
{
    Telerik.Reporting.Processing.DetailSection section = (sender as Telerik.Reporting.Processing.DetailSection);
    object _iD = section.DataObject["ID"];
    tblObjective.DataSource = ObjectiveService.GetByID(Int32.Parse(_iD.ToString()));
 
    //txtGoal1AreaOfDesiredChange.Value = _objective.ObjectiveAreaofDesiredChange;
    //txtGoal1TimeFrame.Value = _objective.TimeFrameandModality;
    //txtGoal1Objective.Value = _objective.Description;
    //txtGoal1BaseLines.Value = _objective.Baselines;
    //txtGoal1MeasuredBy.Value = _objective.MeasuredBy;
    //txtGoal1Interventions.Value = _objective.Interventions;
}

 

 

2 Answers, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 08 Mar 2017, 10:38 AM
Hi Jonathan,

You can check an update in the support ticket #1096595 you opened on the same question.

For other community members, experiencing the same issue, below is the reply from the ticket:
"This issue is most likely related to the way the items are processed in events - please check Changes on items in report events are not applied KB article for more detailed information.

Though it has always been a requirement to work only with processing items, in previous versions changes were propagated but the result was unpredictable due to the relation to the order of processing of inner elements of the report.

In the attached code, you work with item definitions:
tblObjective.DataSource = ObjectiveService.GetByID(Int32.Parse(_iD.ToString()));
In this case, their DataSource properties will not be updated. In events, you can access and modify only the processing elements - please check Understanding events.
Valid examples of using events are provided in this section. In case, you need to access the processing child items you can use ElementTreeHelper Class and its methods.

Note that it is not recommended to assign the data in events. More appropriate approach is to use DataSource components to retrieve the data.
To filter the data on retrieval you can add data source parameters and map them to report parameters."


Regards,
Katia
Telerik by Progress
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
Jonathan
Top achievements
Rank 1
answered on 08 Mar 2017, 05:18 PM

Hi Katia,

thanks for the help.  hat got me on the right track.  Here's the working code

Telerik.Reporting.Processing.DetailSection section = (sender as Telerik.Reporting.Processing.DetailSection);
 object _iD = section.DataObject["ID"];
 Telerik.Reporting.Processing.Table _table = (Telerik.Reporting.Processing.Table)section.ChildElements["tblObjective"];
 _table.DataSource = ObjectiveService.GetByID(Int32.Parse(_iD.ToString()));

 

Best,

Jonathan

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