I have an asp.net content page with a Sql server Report Viewer control on it. The master page [now] has an asp.net ScriptManager on it. This combination threw this JavaScript error: “'this._postbackSettings.async' is null or not an object”. So, I Binged Googled that message and found lots of hits. It appears this error occurs because the client-side code [sent via scriptmanager] is trying to determine if partial rendering will be needed and by *whom*. Since my page had no controls which would invoke and Http post/get (those were inside the IFrame containing the report viewer), the client-side code could not really deal with it. So, the solution was to disable partial rendering on the script manager on the master page (credit to this article for the idea). I took the idea in that article and made it strongly-typed (so you don’t have to do a FindControl and pass around a string control id) to make the code more durable:
- Add a “ScriptManager” property on the master page to expose this control.
/// <summary>
/// Allows external access to the script manager.
/// </summary>
internal ScriptManager ScriptManager
{
get { return this.scriptManager; }
}
- Add the [awesome] MasterType directive to your content page which gives strongly-typed access to your master page:
<%@ MasterType VirtualPath="~/MasterPage.Master" %>
- In your content page (containing the report viewer) sink the Page_Init event as such:
protected void Page_Init(object sender, EventArgs e)
{
this.Master.ScriptManager.EnablePartialRendering = false;
}