I have been going back and forth banging my head against a wall trying to fix a JavaScript error that was happening on my Reporting Services ReportViewer control when the View Report button is clicked. The error was a JavaScript error and seemed to be related to using something AJAX related on the same page as the ReportViewer control, but it took me a while to figure out what it was and fix it. All of the problems I saw on the web related to using either an AJAX update panel or one of the extenders in the AJAX Control Toolkit. Unfortunately for me I wasn’t using either one of them so trying to figure this one out was tricky.
The specific JavaScript error was:
Microsoft JScript runtime error: ‘this._postBackSettings.async’ is null or not an object
My page was setup where I had a master page with an AJAX menu on it (Radmenu to be specific). In order to use the Radmenu you need a ScriptManager object. Other than the menu, I didn’t have any AJAX related controls on either the master page or the content page.
What I eventually figured out was that my report pages (which use a base class) needed to disable partial rendering. To do this, you must do it in your page’s init event. If you do it after the init you’ll get an invalid operation exception. Here’s the code in the base class (you can put this in your code behind if you’re not using a base class):
Private Sub Page_Init1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init ' Make sure this page has a master page If Not IsNothing(Me.Master) Then Dim masterScriptManager As ScriptManager masterScriptManager = CType(Master.FindControl("MasterScriptManager"), ScriptManager) ' Make sure our master page has the script manager we're looking for If Not IsNothing(masterScriptManager) Then ' Turn off partial page postbacks for this page masterScriptManager.EnablePartialRendering = False End If End If End Sub
Just in case others stumble across this and are trying to solve their problem, here are some of the links I landed on when trying to solve the problem: