1 year ago

#264640

test-img

Fame th

How to change a subreport at runtime in rdlc report?

I created Main report named "ReportMain.rdlc". Inside this main report added subreport.

Main Report

enter image description here

I have a lot of subreport but I need to select only one subreport for showing in a Main report. So I need to set subreport path by dynamically. For example, I have three subreports such as "ReportSub1.rdlc", "ReportSub2.rdlc" and "ReportSub3.rdlc". I made a condition for selecting subreport by these code.

        If (strReport == "1") Then {
            m_LocalReport.LoadSubreportDefinition("MySubreport", File.OpenRead("Reports/ReportSub1.rdlc"))
        }else if (strReport == "2"){
            m_LocalReport.LoadSubreportDefinition("MySubreport", File.OpenRead("Reports/ReportSub2.rdlc"))
        }else if (strReport == "3"){
            m_LocalReport.LoadSubreportDefinition("MySubreport", File.OpenRead("Reports/ReportSub3.rdlc"))
        }

But I don't know how to set Use this report as a report: in designer.

enter image description here

I want to set at runtime. What should I input to this box?

(I've ever added all subreport and set hide or visible. This way is work. But I have a lot of subreport. A main report will create all subreports although it was hidden. So a rendering is very slow performance.)

c#

reporting-services

rdlc

rdl

0 Answers

Your Answer

Accepted video resources