none
Using custom parameters with MVC report viewer

    Question

  • Newbie :-)

    I have a controller and a view with custom parameters and a div that is hidden initially but when you click a button I want the report viewer to show a report. Currently when you click the button to show the report, the report shows with the default parameters. My next task is to hide the SSRS parameter pane and send in my own parameters. Does anyone know of a step by step guide that can help me? I feel like this should be simple, but am lost :--(.

    Help much appreciated,

    Linda



    Linda

    Friday, April 21, 2017 7:08 PM

All replies

  • Hi Linda Cornerstone,

    If I understand correctly, you have two requirements, one is dynamically show/hide report viewer control, the other one is hide the report parameter pane, right?

    To your first question, you can use Control.Visibility to get or set a value that indicates whether a server control is rendered as UI on the page. If this property is false, the server control is not rendered. If a container control is not rendered, any controls that it contains will not be rendered even if you set the Visible property of an individual control to true. Here is a link which provides sample code about how to dynamic set control visibility: How to show or hide control dynamically. By the way, the default parameter values should be specified when designing a .rdlc report.

    To your second question, if you want to hide the parameter pane, there are two ways to achieve that. You can set parameter visibility to hidden in parameter properties and remember to give default values. Alternatively, you can hide parameter pane via URL access. That is to say, append "&rv:Toolbar=Navigation" to report URL when you add report source into report viewer control.

    But if you want to dynamically show/hide parameters when running report, unfortunately, it is not supported by SSRS now.

    If you still have any question, please feel free to ask.

    Best regards,
    Yuliana Gu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 24, 2017 9:40 AM