Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pass ReportViewer Parameter as Report Title

Posted on 2011-09-20
15
Medium Priority
?
1,675 Views
Last Modified: 2012-08-14
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("userOptions", "xxx")
ReportViewer1.LocalReport.SetParameters(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?
0
Comment
Question by:AmyFPA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
15 Comments
 
LVL 8

Expert Comment

by:pdd1lan
ID: 36567643
try to put put "Me.ReportViewer1.RefreshReport()"

Dim params As ReportParameter() = New ReportParameter(0) {}
params(0) = New ReportParameter("userOptions", "xxx")
ReportViewer1.LocalReport.SetParameters(params)
Me.ReportViewer1.RefreshReport()
0
 

Author Comment

by:AmyFPA
ID: 36568585
Yes, I have RefreshReport.  But the error comes on the SetParameters line.
0
 
LVL 8

Expert Comment

by:pdd1lan
ID: 36568624
I copied your code, set textbox in page head =Parameters!userOptions.Value
and run it and it worked for me

 Dim params As ReportParameter() = New ReportParameter(0) {}
        params(0) = New ReportParameter("userOptions", "xxx")
        ReportViewer1.LocalReport.SetParameters(params)
        Me.ReportViewer1.RefreshReport()
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:AmyFPA
ID: 36569031
So it must be something in my report.  My report runs just fine without that line where it uses the parameters.
0
 
LVL 8

Expert Comment

by:pdd1lan
ID: 36580444
have you tried to create a new RDLC report instead?  something might helps.
0
 

Author Comment

by:AmyFPA
ID: 36719553
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?
0
 

Author Comment

by:AmyFPA
ID: 36720102
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."
0
 
LVL 8

Expert Comment

by:pdd1lan
ID: 36891598
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....
0
 

Author Comment

by:AmyFPA
ID: 36903373
Yes, I have created the parameter userOptions.

Here is my rdlc file.
TasksToDo.rdlc.txt
0
 
LVL 8

Expert Comment

by:pdd1lan
ID: 36904044
try it:

delete your "userOptions" parameter in your report, remove =Parameters!userOptions.Value in textbox8

recreate "userOptions" parameter in your report, and reset "=Parameters!userOptions.Value" 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).



0
 

Author Comment

by:AmyFPA
ID: 36912925
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?
0
 
LVL 8

Expert Comment

by:pdd1lan
ID: 36935966
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("userOptions", "xxx")
        ReportViewer1.LocalReport.SetParameters(params)
        Me.ReportViewer1.RefreshReport()
0
 

Author Comment

by:AmyFPA
ID: 36942277
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."
0
 
LVL 8

Accepted Solution

by:
pdd1lan earned 375 total points
ID: 36951934
0
 

Author Closing Comment

by:AmyFPA
ID: 36955638
Success!  Yea!

I needed both refreshes:
ReportViewer1.LocalReport.Refresh()
ReportViewer1.RefreshReport()
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question