none
WinForms reportViewer.ServerReport.GetParameters doesn't populate prompt property RRS feed

  • Question

  • Hi,

    I've come to the conclusion that the ReportViewer control's support for parameters isn't sufficient for my needs (auto-complete, etc) and have started to implement custom parameter handling. However, I still want to use the ReportViewer control for the actual display/navigation of the report data. So my approach is that I will use the ServerReport.GetParameters() method to find all of the parameters associated with my reports (server reports) and then programatically create input controls for each parameter. I will then take the values from all of the input controls and create a collection ReportParameters to pass to ServerReport.SetParameters(). So far the approach seems to be working fairly well. However, I'm running in to a problem where despite the fact that I have definitely specified a Prompt for my report parameters, the value doesn't seem to come back in the result of GetParameters(). Is this a known issue? Am I doing something wrong?

    EDIT: I suppose I should mention I'm using VS2008 and SSRS 2008. I suppose it's possible that it's a bug with the underlying RS web service but I wanted to check here before I start tracing IP packets to see if that data is being passed back from the SSRS server or not.

    Thanks,
    Kyle
    Wednesday, October 28, 2009 8:51 PM

Answers

  • Okay, I've solved this problem. If, in your report definition, your parameters have their visibility set to Hidden or Internal, then you will not be able to retrieve the "Prompt" property in the ParameterInfo objects returned by GetParameters. I'm still not sure if this is an SSRS or a ReportViewer thing, but I would venture to guess it's probably SSRS. I think this behavior is kind of silly, but there's a workaround if you're trying to do something like what I described above. Leave your parameters Visible in the report definition, but set your reportviewer objects "ShowParameterPrompts" property to false to get the same effect and have the Prompt returned to you so that you can display it in your custom parameter window.

    Kyle
    • Marked as answer by kylejmcintyre Wednesday, October 28, 2009 10:26 PM
    Wednesday, October 28, 2009 10:26 PM

All replies

  • Okay, I've solved this problem. If, in your report definition, your parameters have their visibility set to Hidden or Internal, then you will not be able to retrieve the "Prompt" property in the ParameterInfo objects returned by GetParameters. I'm still not sure if this is an SSRS or a ReportViewer thing, but I would venture to guess it's probably SSRS. I think this behavior is kind of silly, but there's a workaround if you're trying to do something like what I described above. Leave your parameters Visible in the report definition, but set your reportviewer objects "ShowParameterPrompts" property to false to get the same effect and have the Prompt returned to you so that you can display it in your custom parameter window.

    Kyle
    • Marked as answer by kylejmcintyre Wednesday, October 28, 2009 10:26 PM
    Wednesday, October 28, 2009 10:26 PM
  • I'm experiencing the same problem. The "Visible" and "Prompt" property always return "true" regardless of what was set on the server. My guess would be a bug in the ReportViewer control.

    I'm using Visual Studio 2012, ASP.NET 4.0. The control is Microsoft.ReportViewer.WebForms v2.0.50727.

    Quentin

    Wednesday, March 25, 2015 7:19 PM