Amy
asked on
Pass ReportViewer Parameter as Report Title
I would like to pass a parameter to a ReportViewer to use in the Page Heater.
I have the code:
Dim params As ReportParameter() = New ReportParameter(0) {}
params(0) = New ReportParameter("userOptio ns", "xxx")
ReportViewer1.LocalReport. SetParamet ers(params )
I have the parameter userOptions set in the Report Parameters dialog as a string data type.
And I have a text box in the Page Header whose Value is set to:
=Parameters!userOptions
Without this parameter the report runs just fine, but with it, I get the error LocalProcessingException, "An error occurred during local report processing," on the third line of code shown above.
Could there be something I'm not filling out in the dialog? Or what do I have wrong?
I have the code:
Dim params As ReportParameter() = New ReportParameter(0) {}
params(0) = New ReportParameter("userOptio
ReportViewer1.LocalReport.
I have the parameter userOptions set in the Report Parameters dialog as a string data type.
And I have a text box in the Page Header whose Value is set to:
=Parameters!userOptions
Without this parameter the report runs just fine, but with it, I get the error LocalProcessingException, "An error occurred during local report processing," on the third line of code shown above.
Could there be something I'm not filling out in the dialog? Or what do I have wrong?
ASKER
Yes, I have RefreshReport. But the error comes on the SetParameters line.
I copied your code, set textbox in page head =Parameters!userOptions.Va lue
and run it and it worked for me
Dim params As ReportParameter() = New ReportParameter(0) {}
params(0) = New ReportParameter("userOptio ns", "xxx")
ReportViewer1.LocalReport. SetParamet ers(params )
Me.ReportViewer1.RefreshRe port()
and run it and it worked for me
Dim params As ReportParameter() = New ReportParameter(0) {}
params(0) = New ReportParameter("userOptio
ReportViewer1.LocalReport.
Me.ReportViewer1.RefreshRe
ASKER
So it must be something in my report. My report runs just fine without that line where it uses the parameters.
have you tried to create a new RDLC report instead? something might helps.
ASKER
I tried creating another report and using that one. Now I get the message that the "parameter is missing a value."
Could it be that I'm setting things wrong in the Report Parameters dialog?
Could it be that I'm setting things wrong in the Report Parameters dialog?
ASKER
Now I've tried checked the box in the Report Parameters to allow null values, and I get the message, "Some parameters or credentials have not been specified."
in the report, have you created a Parameters (userOptions)?
can you attach your report (rdlc) file? I give it a look if you would like....
can you attach your report (rdlc) file? I give it a look if you would like....
ASKER
try it:
delete your "userOptions" parameter in your report, remove =Parameters!userOptions.Va lue in textbox8
recreate "userOptions" parameter in your report, and reset "=Parameters!userOptions.V alue" in your textbox 8. and should fix your issue.
also, your textbox8 was set in visible= false (hide mode), you need to set it to visible = true (visibillity to show).
delete your "userOptions" parameter in your report, remove =Parameters!userOptions.Va
recreate "userOptions" parameter in your report, and reset "=Parameters!userOptions.V
also, your textbox8 was set in visible= false (hide mode), you need to set it to visible = true (visibillity to show).
ASKER
Now I get "The 'userOptions' parameter is missing a value" instead of the report showing in the ReportViewer when I run it.
Is there something I need to set in the parameters?
Is there something I need to set in the parameters?
look like your report parameter does not check for "Allow blank value" or "allow null value" property.
if you don't check them in your "userOptions" report parameter, and then when you pass a null or empty value into your report, it will give you "parameter is missing a value" error.
------
Dim params As ReportParameter() = New ReportParameter(0) {}
params(0) = New ReportParameter("userOptio ns", "xxx")
ReportViewer1.LocalReport. SetParamet ers(params )
Me.ReportViewer1.RefreshRe port()
if you don't check them in your "userOptions" report parameter, and then when you pass a null or empty value into your report, it will give you "parameter is missing a value" error.
------
Dim params As ReportParameter() = New ReportParameter(0) {}
params(0) = New ReportParameter("userOptio
ReportViewer1.LocalReport.
Me.ReportViewer1.RefreshRe
ASKER
Thank you, pdd1lan.
I copied your code exactly, and I checked the box to allow for Null values.
Now where the report should show in the ReportViewer when I run it, it says "Some parameters or credentials have not been specified."
I copied your code exactly, and I checked the box to allow for Null values.
Now where the report should show in the ReportViewer when I run it, it says "Some parameters or credentials have not been specified."
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Success! Yea!
I needed both refreshes:
ReportViewer1.LocalReport. Refresh()
ReportViewer1.RefreshRepor t()
I needed both refreshes:
ReportViewer1.LocalReport.
ReportViewer1.RefreshRepor
Dim params As ReportParameter() = New ReportParameter(0) {}
params(0) = New ReportParameter("userOptio
ReportViewer1.LocalReport.
Me.ReportViewer1.RefreshRe