How to add a Clear button to SQL Server Reporting Services (SSRS)

Add a clear button to SQL Server Reporting Services

If you ever had the need to add a clear / reset button to your standard SQL Server Reporting Services report viewer, here’s a way to do it. Normally when reports are displayed, they are piped through the ReportViewer.aspx page that comes with SSRS. This page hosts the Reporting Server host component, and adds text boxes, radio buttton etc. based on the number of parameters you have in your report. So here’s a way to add a clear button to SQL Server Reporting Services.

Something like this:


You can’t simply replace this file with your own custom page, because SSRS has HTTP handlers installed that prevents any other file to be rendered except the ReportViewer.aspx page.

So how to add a clear button to clear the text boxes? One way to do it is to modify the OOB ReportViewer.aspx page by injecting some javascript that does this for us. Initially I wanted to use jQuery, but again, the HTTP handler prohibits us from accessing the external .js file. Back to plain old Javascript it is.

Essentially, we just need to find the container that holds the View Report button, and add our custom button.

In the body tag, add a page onload event handler:

and then add some javascript code:


The final result will look something like this:


The code can be found on at: Custom SQL Server Reporting Services ReportViewer.aspx page