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

Set Sub Report data source at Master Report - Detail ItemDataBound

1 Answer 261 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Emilie
Top achievements
Rank 1
Emilie asked on 26 Mar 2009, 07:41 AM
Hi,

I  create a subreport in the detail by passing display ID as below:

  private void detail_ItemDataBound(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.DetailSection section = sender as Telerik.Reporting.Processing.DetailSection;
            DataRowView row = section.DataItem as DataRowView;
            object ID = row.Row["ID"];

            if ((row["ID"] != null) && (row["ID"].ToString().Length != 0))
            {
                              
                //pass parameter- ID, date from & date to
                this.subDrivingLicense.ReportSource = new rptDriverReminderSub1();
                this.subDrivingLicense.ReportSource.DataSource = blDrivingLicense.ListRecords(ID.ToInt(), strDateFrom, strDateTo);

            }                          
        }

but sub report always show "the expression contains object "ExpiryDate" that is not defined in the current context".

What should i do to fix it?anything i miss out?

1 Answer, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 26 Mar 2009, 10:12 AM
Hi Emilie,

The ItemDataBound event is not the right place to specify a data source for your sub-report, because it is fired after the report is bound to a data source. You should consider using the NeedDataSource event of the sub-report instead. A more in-depth explanation of the report events and when they are fired can be found in our online documentation.

We hope this helps resolving your problem. If this is not the case, please, drop us a line.

All the best,

the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Emilie
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Share this question
or