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

Need help setting datasource for subreport

1 Answer 67 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Zack
Top achievements
Rank 1
Zack asked on 19 May 2013, 08:21 PM
Hello,

My company just purchased a bunch of Telerik controls. We noticed there was a reporting control so we wanted to take a look at it. Currently we are using Active Reports for all our reports. I was asked to look into what the Telerik Reporting could do for us. I wanted to create a simple report with a few text boxes and a subreport to show data. I am having a hard time though getting data to show in a sub report. I have to set all the report data in a usercontrol file. Since the report would be dynamically filled, I have to reference each control and set the data source to whatever I need. I call my PrepareReport() function to load the data into the report and then stream it. I am able to access my textboxes and set their values and those show fine.The datset below returns 4 records but nothing shows in the subreport when I run it. What am I missing? Any help would be greatly appreciated. I have searched through this forum and google and can't seem to find a solution for what I want to do. Thanks!
private void PrepareReport(Telerik.Reporting.Report rpt)
{
    Telerik.Reporting.DetailSection detail = (Telerik.Reporting.DetailSection)rpt.Items["detail"];
 
    Telerik.Reporting.TextBox txt = (Telerik.Reporting.TextBox)detail.Items["txtDNIdValue"];
    txt.Value = "11111";
 
    Telerik.Reporting.SubReport subRpt = (Telerik.Reporting.SubReport)detail.Items["subReport1"];
 
    DataSet ds = new DataSet();
    ds = FunctionToFillDataSet();
 
    subRpt.Report.DataSource = ds;
}

Zack

 

 

 

1 Answer, 1 is accepted

Sort by
0
Zack
Top achievements
Rank 1
answered on 20 May 2013, 06:49 PM
I figured it out.

Thanks,

Zack
Tags
General Discussions
Asked by
Zack
Top achievements
Rank 1
Answers by
Zack
Top achievements
Rank 1
Share this question
or