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

Problem with web subreports

2 Answers 67 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
RONNY JOHNSTON
Top achievements
Rank 1
RONNY JOHNSTON asked on 14 Sep 2009, 11:53 PM
Greetings,  I have set up a report using a subreport which I will ultimately send to a PDF file from a web link.

I have set up the subreport and its parameters as instructed in various places on the site, and although the title of the subreport shows, no data is produced.  The subreport is getting the correct value for the parameter being passed which I can tell by having the {Parameter.rOrdNo} printed in the title line.

However, again, no data is being selected.

The code behind for the subreport is shown below.  What am I missing?

Thanks

public

partial class OrdProfMulti : Telerik.Reporting.Report

 

{

 

public OrdProfMulti( )

 

{

 

 

InitializeComponent();

 

 

try

 

{

 

this.arloeDataSet1TableAdapter1.GetData(Convert.ToInt32(this.Report.ReportParameters["rOrdNo"].Value.ToString()));

 

 

this.arloeDataSet1TableAdapter1.Fill(this.aRLOEDataSet1.ARLOEDataSet1Table, Convert.ToInt32(this.Report.ReportParameters["rOrdNo"].Value.ToString()));

 

}

 

catch (System.Exception ex)

 

{

 

System.Diagnostics.Debug.WriteLine(ex.Message);

 

}

}

 

private void OrdProfMulti_NeedDataSource( object sender, EventArgs e )

 

{

 

Telerik.Reporting.Processing.

Report report = (Telerik.Reporting.Processing.Report)sender;

 

 

this.arloeDataSet1TableAdapter1.GetData(Convert.ToDecimal(this.Report.ReportParameters["rOrdNo"].Value.ToString()));

 

 

this.arloeDataSet1TableAdapter1.Fill(this.aRLOEDataSet1.ARLOEDataSet1Table, Convert.ToDecimal(this.Report.ReportParameters["rOrdNo"].ToString()));

 

report.DataSource = aRLOEDataSet1;

 

 

}

 

}

2 Answers, 1 is accepted

Sort by
0
Accepted
Steve
Telerik team
answered on 15 Sep 2009, 09:14 AM
Hi Ronny,

You cannot use report parameters in the report constructor and we're sure this is never used/shown in the various places you've looked on the site. If you need to filter the data based on a param/variable prior to binding the report, then you need to use the NeedDataSource event, which you've tried, but as noted in the latter article - it will fire only if the report has no data source set. So make sure the DataSource property of the report is not set in the report designer or set this.DataSource = null; in the report constructor. Then in the NeedDataSource event, you should use the evaluated parameters of the report processing object e.g.:

Convert.ToDecimal(this.Report.ReportParameters["rOrdNo"].Value.ToString())

should be:

Convert.ToDecimal(report.Parameters["rOrdNo"].ToString())

Regards,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
RONNY JOHNSTON
Top achievements
Rank 1
answered on 15 Sep 2009, 04:59 PM
You da man!  OK Now I get it.  Thank you!
Tags
General Discussions
Asked by
RONNY JOHNSTON
Top achievements
Rank 1
Answers by
Steve
Telerik team
RONNY JOHNSTON
Top achievements
Rank 1
Share this question
or