none
Is it possible to pass variable from app to control in report? RRS feed

  • Question

  • Is it possible to pass variable from app to control in report - for example text box?

    Thanks for help.
    Thursday, January 10, 2008 12:05 PM

Answers

  • Yes it is

     

     

    when you are in your report designer, in the blank space under the report, right click, and choose "Report Parameters"

    Add a parameter, and give it a name, in nthe case of our example we will name it "Data", and give it a Datatype of String... if your using an .RDLC, ignore the Prompt, as it's only used in association with .RDL reports, now hit Ok.

     

    In the textbox control on your report add the following expression:

     

    Parameters!Data.Value

     

    On the page that your reportvieweer loads, add the following code:

     

     

    ReportParameter data = new ReportParameter("Data", appValue); //place the value you want to pass

    ReportViewer1.LocalReport.SetParameters(new ReportParameter[] {data});

     

     

    appValue being the variable that contains the data you want to pass to your report...

     

    Hope this helps

    Thursday, January 10, 2008 3:11 PM

All replies

  • Yes it is

     

     

    when you are in your report designer, in the blank space under the report, right click, and choose "Report Parameters"

    Add a parameter, and give it a name, in nthe case of our example we will name it "Data", and give it a Datatype of String... if your using an .RDLC, ignore the Prompt, as it's only used in association with .RDL reports, now hit Ok.

     

    In the textbox control on your report add the following expression:

     

    Parameters!Data.Value

     

    On the page that your reportvieweer loads, add the following code:

     

     

    ReportParameter data = new ReportParameter("Data", appValue); //place the value you want to pass

    ReportViewer1.LocalReport.SetParameters(new ReportParameter[] {data});

     

     

    appValue being the variable that contains the data you want to pass to your report...

     

    Hope this helps

    Thursday, January 10, 2008 3:11 PM

  • It works, thank you!
    Friday, January 11, 2008 9:35 AM