How to change visibility of parameters

Attachments

In order to change the visibility of parameters, it is needed to subscribe to the ParameterVisibilityChanging event of the ReportViewer object in the parameters toolbar. You should change the visibility value for the parameter in the event handler.

Example:

reportViewer.ParameterVisibilityChanging += 
new EventHandler(reportViewer_ParameterVisibilityChanging);

void reportViewer_ParameterVisibilityChanging
(object sender, ParameterVisibilityChangingEventArgs e)
        {
            if (e.ParametersCollection != null)
            {
                foreach (var item in e.ParametersCollection)
                {
                    if (item.Nullable)
                        item.Visibility = false;
                }
            }
        }

The report generation without hiding the parameters:

The report generation with checking if null value is possible:

Add Feedback