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

Master-SubReport with Dataset

1 Answer 149 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 08 Jul 2009, 02:43 PM
Hi

I know, there are already a lot of article in this forum, that covers this topic.
I read a lot of them, and the documentation and watched a few videos ... i don't get this to work!
Please help.

Scenario:
MasterReport:
public partial class repRegisterConfirmMaster : Telerik.Reporting.Report  
  {  
    private int iBenutzerId = -1;  
    public int PARAMETER_BenutzerId  
    {  
      get { return iBenutzerId; }  
      set { iBenutzerId = value; }  
    }  
 
    private int iOrderId = -1;  
    public int PARAMETER_OrderId  
    {  
      get { return iOrderId; }  
      set { iOrderId = value; }  
    }  
 
    private sbyte iSpracheId = -1;  
    public sbyte PARAMETER_SpracheId  
    {  
      get { return iSpracheId; }  
      set { iSpracheId = value; }  
    }  
 
    public repRegisterConfirmMaster()  
    {  
      InitializeComponent();  
    }  
 
    public void loadReportData()  
    {  
        this.dsBenutzerKundeAdresseKontaktTableAdapter1.Fill(this.dsBenutzerKundeAdresseKontakt.dsBenutzerKundeAdresseKontaktTable, iBenutzerId);  
    } 

I have in the dataset "@BenutzerId" included in the query and this is used when filled the DataTable. Works fine.

The Subreport just looks the same:
public partial class subRegisterConfirmModul : Telerik.Reporting.Report     
  {     
    private int iOrderId = -1;     
    public int PARAMETER_OrderId     
    {     
      get { return iOrderId; }     
      set { iOrderId = value; }     
    }     
    
    private sbyte iSpracheId = -1;     
    public sbyte PARAMETER_SpracheId     
    {     
      get { return iSpracheId; }     
      set { iSpracheId = value; }     
    }     
    
    public subRegisterConfirmModul()     
    {     
      InitializeComponent();     
    }     
    
    public void loadReportData()     
    {     
      this.dsKundenModulByOrderIdTableAdapter1.Fill(this.dsKundenModulByOrderId.dsKundenModulByOrderIdTable, (byte) iSpracheId, iOrderId);  
    }    
 

Now, from an aspx-page, i call the report, set the values of the master-report and calling the loadReportData() of the master.
...
        
ReportViewer1.Report = new repRegisterConfirmMaster();  
        (ReportViewer1.Report as repRegisterConfirmMaster).PARAMETER_BenutzerId = 77;  
        (ReportViewer1.Report as repRegisterConfirmMaster).PARAMETER_OrderId = 94;  
        (ReportViewer1.Report as repRegisterConfirmMaster).PARAMETER_SpracheId = S.SpracheId;  
        (ReportViewer1.Report as repRegisterConfirmMaster).loadReportData(); 

The report shows up, but only the report-header (filled thru master) is filled with datas. The detail section (filled thru subreport) generates an error or the whole subreport is invisible.
I try these things as well:
- using NeedDataSource in master (subreport_needDataSource) and/or subreport
- ItemDataBinding in master (detail_ItemdataBinding)
- Calling SubReport.loadReportData() from within the Master.loadReportData(), with setting the appropriate values of the subreport first
- Every combination af the aboved mentioned, and a few helpless tries more
- I even recoded the whole thing, trying to work with the integrated Report.Parameters as described in the help documentation ... no luck: designing-reports-master-detail.html
- I get it once to work: I hardcoded the correct values of "iOrderId" and "iSpracheId" in the subreport. So i think passing the parameters at the right time, in the right place, the right way, then it should work.
I'm sure, there has to be a simple way to do this.

TIA
Markus

1 Answer, 1 is accepted

Sort by
0
Markus
Top achievements
Rank 1
answered on 10 Jul 2009, 09:36 AM
Nevermind
After re-design, the report works.
I think, you should not use the option to fill the dataset thru public properties (like "... WHERE xy = @xy" in the select statement) with a subreport. The filling of the subreports public properties at the right moment is not getting to work. At least i couldn't get it to work.

Use the build-in ReportParameters to get the datas filtered. It's not as comfortable as with the public properties (which can be used thru the given, selfexplaining name), because of the ReportParameters ared used thru the index number, which is not telling anything about the parameter.

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