Reporting Services 2008 R2 javascript errors when using date parameters RRS feed

  • Question

  • I'm getting javascript errors on my SQL Server Reporting Services R2 reports running under IIS 7. The reports are running on the same server as IIS. The report viewer control on a classic page with no other controls (originally this was embedded in an iFrame on an MVC 1.0 page, but I have changed to directly running the classic page).

    I have not added extra custom javascript on the reports. That is to say, there is only the stock javascript that comes with the report viewer control on the page.


    Under Firefox 4, when I run a report with a date parameter, the report runs OK with the default dates. If I change them, I get these errors:


    frames.ReportViewerTouchSession0.location is null
    document.getElementById("ReportViewer_ctl00").ParametersController is undefined 


    The report does not refresh, either by the automatic post back or if I manually trigger one via the "View Report" button.

    IE8 I get this:


    'document.getElementById(...).ParametersController' is null or not an object
    IE8's debugger breaks on some random location in the ViewState.

    IE9's error is different (when you click on the date picker):
    Unable to get value of the property 'ToggleVisibility': object is null or undefined 
    Unable to get value of the property 'HideActiveDropDown': object is null or undefined 
    Again, the debugger can't give me a useful line number in any source code.
    There aren't any 404 network errors that might indicate scripts aren't being loaded.

    Changing the AsyncRendering property between True and False doesn't have any affect.

    I've found that you need to move the web hander in web.config as detailed here. Which fixed some other problems I was having, but this problem remains.
    The error does not occur when I run the reports from the report manager. It seems specific to the ASP.NET web control.

    The error does occur on a staging server (Windows Server 2008 R2 with SQL Enterprise R2) and on a development machine (Windows 7 SP1 with SQL Express 2008 R2 with advanced services). We have not tested in a live environment (for obvious reasons!).

    I'm tearing my hair out with this one!

    Note: this as been cross posted on Stackoverflow and reposted from the Reporting Services forum on MSDN.
    Friday, April 29, 2011 6:25 AM

All replies

  • For completeness, here's the code for the page:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" Inherits="Tenders.Web.Report" %>
    <%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="" >
    <head runat="server"></head>
      <form id="form1" action="/Report.aspx" runat="server">
      <asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" ScriptMode="Release">
      <asp:UpdatePanel ID="ReportViewerUP" runat="server">
          <rsweb:ReportViewer ID="ReportViewer" runat="server" Width="100%" ProcessingMode="Local"
           InteractivityPostBackMode="AlwaysAsynchronous" AsyncRendering="true">
    And the c# code behind:
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Net;
    using System.Security.Principal;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.MobileControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using Microsoft.Reporting;
    using Microsoft.Reporting.WebForms;
    using Tenders.Core.Helpers;
    using Tenders.Core.Models;
    using Tenders.Core.Repositories;
    using Tenders.Web.Helpers;
    namespace Tenders.Web
      public partial class Report : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
          using (NHibernateHelper.BeginTransaction())
            MembershipUser membershipUser = Membership.GetUser();
            if (membershipUser == null)
              throw new Exception("You must be logged in to access the reports.");
            SecurityService securityService = new SecurityService();
            User user = new UserRepository().GetByUsername(membershipUser.UserName);
            if (!securityService.UserHas(user, false, Right.ViewAccountingReports))
              throw new Exception("You are not authorised to access this report.");
          if (Page.IsPostBack) return;
          string report = Request.Params["reportName"];
          if (!String.IsNullOrEmpty(report)) {
            ReportViewer.ShowCredentialPrompts = true;
            ReportViewer.ServerReport.ReportServerCredentials = new TendersReportServerCredentials();
            ReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
            ReportViewer.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServerAddress"]);
            ReportViewer.ServerReport.ReportPath = report;
            //ReportParameter[] parm = new ReportParameter[2];
            //parm[0] = new ReportParameter("dateStart", DateTime.UtcNow);
            //parm[1] = new ReportParameter("dateEnd", DateTime.UtcNow);
      public sealed class TendersReportServerCredentials : IReportServerCredentials
        public WindowsIdentity ImpersonationUser
            // Use the default Windows user. Credentials will be
            // provided by the NetworkCredentials property.
            return null;
        public ICredentials NetworkCredentials
            // Read the user information from the Web.config file. 
            // By reading the information on demand instead of 
            // storing it, the credentials will not be stored in 
            // session, reducing the vulnerable surface area to the
            // Web.config file, which can be secured with an ACL.
            // User name
            string userName = 
            if (string.IsNullOrEmpty(userName))
              throw new Exception(
                "Missing user name from web.config file");
            // Password
            string password =
            if (string.IsNullOrEmpty(password))
              throw new Exception(
                "Missing password from web.config file");
            // Domain
            string domain =
            if (string.IsNullOrEmpty(domain))
              throw new Exception(
                "Missing domain from web.config file");
            return new NetworkCredential(userName, password, domain);
        public bool GetFormsCredentials(out Cookie authCookie,
              out string userName, out string password,
              out string authority)
          authCookie = null;
          userName = null;
          password = null;
          authority = null;
          // Not using form credentials
          return false;
    Note: this as been cross posted on Stackoverflow and reposted from the Reporting Services forum on MSDN.


    Friday, April 29, 2011 6:25 AM
  • It appears I was using the wrong version of the report viewer control. Changing project and web.config reference from v9 to v10 of the Microsoft.ReportViewer.WebForms assembly has fixed the issue.

    See this connect bug for more info (including demo projects to reproduce the bug and the fix):

    Sunday, October 16, 2011 11:33 PM