Visual Studio Developer Center > Visual Studio Forums > Visual Studio Report Controls > using different redlc while generating a report
Ask a questionAsk a question
 

Questionusing different redlc while generating a report

  • Thursday, October 29, 2009 6:13 AMmeghanalohit Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
              I m using 4 different reports to my query.
    if the user selects choice no 1 then 1.rdlc is to be generated .
    if user selects choice no 2 then 2.rdlc is to be generated and so on.
    the problem is once the user selects choice no1 the particular report (1.rdlc) is generated n now when the user goes back n selects choice no2 , this time 1.rdlc only is generated n nt 2.rdlc. How to solve this. Even though i ve changed the embedded source it shows up the previous report only
    code is provided below

     

    private void ReportDesign(Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1, Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2, Microsoft.Reporting.WinForms.ReportDataSource reportDataSource3)

    {

     

    this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;

    reportDataSource1.Name =

    "DailyReportDataSet_Summary";

    reportDataSource1.Value =

    this.summaryBindingSource;

    reportDataSource2.Name =

    "DailyReportDataSet_Details";

    reportDataSource2.Value =

    this.detailsBindingSource;

    reportDataSource3.Name =

    "DailyReportDataSet_RefPhysicianShare";

    reportDataSource3.Value =

    this.RefPhysicianShareBindingSource;

     

    this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1);

     

    this.reportViewer1.LocalReport.DataSources.Add(reportDataSource2);

     

    this.reportViewer1.LocalReport.DataSources.Add(reportDataSource3);

     

    if (cbReportType.Text == "OutPatient Invoice Details Report")

    {

     

     

    this.reportViewer1.LocalReport.ReportEmbeddedResource = "PracticeManagement.ReportModule.Views.OutPatientInvoiceDetailsReport.rdlc";

    }

     

    else if (cbReportType.Text == "Diagnostic Lab Report"||cbReportType.Text=="OutPatient Collection Report")

    {

     

     

    this.reportViewer1.LocalReport.ReportEmbeddedResource = "PracticeManagement.ReportModule.Views.DiagonsticLabReferenceReport.rdlc";

    }

     

    else if (cbReportType.Text == "General Report")

    {

     

    this.reportViewer1.LocalReport.ReportEmbeddedResource = "PracticeManagement.ReportModule.Views.Report1.rdlc";

    }

     

    this.reportViewer1.Location = new System.Drawing.Point(0, 0);

     

    this.reportViewer1.Name = "reportViewer1";

     

    this.reportViewer1.Size = new System.Drawing.Size(609, 509);

     

    this.reportViewer1.TabIndex = 0;

    }


    Meghana Lohit
    • Moved byLing WangMSFTSaturday, October 31, 2009 2:05 PMfor better support (From:Windows Forms General)
    •  

All Replies

  • Monday, November 02, 2009 4:57 AMRajaSekhar-Navigator Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Lohit,

    Instead of passing the Data Set first try to map the rdlc and then add datasource, below i have given my code which is working fine 
    and try to refresh the reoport after assigning dataset and path of the report

    ReportViewer1.LocalReport.ReportPath = Server.MapPath(

    "Report2.rdlc")

    ReportViewer1.LocalReport.DataSources.Add(

    New ReportDataSource("SampleDataSet_StudentInfo", Ds.Tables(0)))

    ReportViewer1.LocalReport.Refresh()

    Hope this helps

    -Raja Sekhar K

  • Monday, November 09, 2009 10:11 AMmeghanalohit Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    No this did not solve my problem.Could any1 tel me what is the solution for this
    Meghana Lohit