Referencing the client side viewer
The ReportViewer client side object inherits from Sys.UI.Control. To obtain a reference to the client side viewer, use the $find method as follows:
var clientViewer = $find(“ReportViewer1”);
The identifier you pass to $find corresponds to the ClientID of the ReportViewer server control.
Checking the state of the viewer
Once you have a reference to the client side viewer, you will want to check the state of the viewer before invoking most of the various methods and properties it exposes. When the viewer is in a loading state, most of the functionality of the client viewer is unavailable and will throw an exception if called. The viewer is loading whenever an asynchronous postback is in progress. It is also in the loading state while retrieving a report page. This usually happens during an asynchronous postback, but can also extend beyond the lifetime of the postback, such as while retrieving images displayed on the report page. To check the state of the viewer, use the isLoading property:
var isLoading = clientViewer.get_isLoading();
Once you have determined that the viewer is no longer loading new data, you can determine what is being displayed using the reportAreaContentType property. It will indicate if the viewer is blank, displaying a report, or displaying an error message:
var reportAreaContentType = clientViewer.get_reportAreaContentType();
if (reportAreaContentType ===
// Perform various operations
Both the isLoading and the reportAreaContentType properties as well as all of the other properties on the client viewer fire the propertyChanged event. Listening to that event can be useful for determining when you should enable or disable your custom UI.
Client side operations