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

Need to set a tables datasource that lives in a subreport

3 Answers 146 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 22 Jun 2009, 03:02 PM
      SqlConnection connSomsys = new SqlConnection(@"Server=cmdivst004\Jason08;Integrated Security=false;Database=QuoteDB; Persist Security Info=True;User ID=cmdiapp;Password=adiadmin");  
            Telerik.Reporting.Processing.SubReport report3 = (Telerik.Reporting.Processing.SubReport)sender;  
 
            SqlCommand selectCommand;  
            selectCommand = new SqlCommand("sprocgetYears", connSomsys);  
            selectCommand.CommandType = CommandType.StoredProcedure;  
            selectCommand.Parameters.AddWithValue("@ousername_vc", this.ReportParameters["ousername_vc"].Value);  
            SqlDataAdapter adapter = new SqlDataAdapter(selectCommand);  
            DataSet dataSet3 = new DataSet();  
            adapter.Fill(dataSet3);  
            
           //Now I would like to do something like the following but cannot, need help with this part...  
            report3.Table1.DataSource = dataSet3;  
             
I have a subreport that contains a table. I need to be able to set the datasource for this table from within the Parent report code behind. I believe i may need to do something with the Item DataBinding events but am not 100% certain. I am using stored procedures and calling them programmatically. Below is a code snippet where near the bottom of the snippet I need to access the table and its datasource that lives in the subreport. Any help would be greatly appreciated

Jason

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 23 Jun 2009, 12:12 PM
Hello Jason,

This is not possible and you should not have to try doing this in the first place. Please elaborate on what your goal/exact scenario is and we would advise you accordingly on how to proceed.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jason
Top achievements
Rank 1
answered on 23 Jun 2009, 01:19 PM
Dear Steve,
   Hi and thanks for your reply. The goal is to have it work within a parent report. What I have is a report(Report1.cs) which has a number of tables on it. Each of these tables has its own datasource and are bound to their own query.This report works fine by itself when I hard code the parameters within the report.
   Now I want to be able to  display this report(Report1.cs) as a subreport within a parent report called MasterReport.cs. I need to be able to pass parameters from the parent report to the subreport. Normally I would be able to do this, but in this case I am not able to access the tables that live within the subreport(Report1.cs). I need to be able to bind the datasources of the tables that lives within the subreport(Report1.cs) using parameters given from MasterReport.cs. 
  As long as I don't have tables involved, i can stick other reports as subreports on the  MasterReport.cs and pass the parameters just fine and they work. Do I need to just put the tables directly on the MasterReport.cs?  Do I need to rework report1.cs so it does not use tables? Any direction would be greatly appreciated.
0
Steve
Telerik team
answered on 26 Jun 2009, 09:08 AM
Hello Jason,

We believe that in this scenario, it would be best to place the tables directly in the master report. They can be looked upon as "separate data regions" so it does not really matter where they are placed. The goal is to keep things as simple as possible, which in this case is to have them directly in the master report.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Jason
Top achievements
Rank 1
Answers by
Steve
Telerik team
Jason
Top achievements
Rank 1
Share this question
or