0

i want to use value of variable name ReportTitle in rdlc report

my c# code is:

this.Report1.LocalReport.ReportPath = @"Report1.rdlc";
ReportParameterCollection reportParms1 = new ReportParameterCollection();
reportParms1.Add(new ReportParameter("ReportTitle", "My Report");
this.Report1.LocalReport.SetParameters(reportParms1);

rdlc code:

<ReportItems>
<Textbox name="ReportTitle">
<Value>=Parameters!ReportTitle.Value>
</Textbox>
</ReportItems>

i am getting exception error in setParameter()Line

Exception is "Error occured during local report processing" Inner Exception is "The definition of report is invalid" Inner Exception is " The Value expression for Textbox refers to an non existing report Parameter

1 Answers1

0

You need to define a ReportParameter in your RDLC before using it:

<ReportParameters>
    <ReportParameter Name="ReportTitle">
        <DataType>String</DataType>
        <Prompt>ReportTitle</Prompt>
    </ReportParameter>
</ReportParameters>

In Visual Studio you can also use View > Report Data instead of directly modifying the RDLC.

tezzo
  • 10,858
  • 1
  • 25
  • 48