20
Vote

Ajax Toolkit 4 does not work with ReportViewer 10

description

After upgrading a project to use .net 4 and the new download I get the following error message for a page that contains a ReportViewer control version 10:

Microsoft JScript runtime error: Sys.ArgumentNullException: Value cannot be null.
Parameter name: panelsCreated[2]

I have tried changing the ScriptManager in the MasterPage to ToolkitScriptManager, but I keep getting the same error.

comments

MikeCarpenter wrote May 11, 2010 at 3:18 PM

We're also encountering this issue. Anyone have any ideas on when Ajax Control Toolkit will be compatible with Report Viewer 2010?

MikeCarpenter wrote May 11, 2010 at 5:17 PM

Ah for our problem we solved it by setting the visibility of the report to false in the aspx file and to true in the code behind file. Not sure if that's related to the problem that rsantos16 reported!

svansted wrote May 22, 2010 at 1:55 AM

Same issue here - everything seems to function but I don't want my users seeing a Javascript error. Here's the script it's attempting when it fails:
$type.registerClass('Sys.WebForms.InitializeRequestEventArgs', Sys.CancelEventArgs);
$type = Sys.WebForms.PageLoadedEventArgs = function PageLoadedEventArgs(panelsUpdated, panelsCreated, dataItems) {
/// <summary locid="M:J#Sys.WebForms.PageLoadedEventArgs.#ctor">The arguments for the PageRequestManager's pageLoaded event. The pageLoaded event is raised after the DOM has been updated.</summary>
/// <param name="panelsUpdated" type="Array">An array of UpdatePanels that were updated.</param>
/// <param name="panelsCreated" type="Array">An array of UpdatePanels that were created.</param>
/// <param name="dataItems" type="Object" mayBeNull="true"></param>
var e = Function._validateParams(arguments, [
    {name: "panelsUpdated", type: Array},
    {name: "panelsCreated", type: Array},
    {name: "dataItems", type: Object, mayBeNull: true}
]);
if (e) throw e;
Sys.WebForms.PageLoadedEventArgs.initializeBase(this);

this._panelsUpdated = panelsUpdated;
this._panelsCreated = panelsCreated;
this._dataItems = dataItems || new Object();
}

svansted wrote May 28, 2010 at 6:16 PM

Debugged ScriptResource.axd & found a bit more detail. I don't know if this is an issue with the toolkit or ReportViewer 10.0 itself. The root problem is this line:

Sys.WebForms.PageRequestManager._initialize('ctl00$cph$ctl00', 'aspnetForm', ['fctl00$cph$ReportViewer1$ReportViewer','','fctl00$cph$ReportViewer1$Toolbar','','fctl00$cph$ReportViewer1$DocMap','','fctl00$cph$ReportViewer1$ctl10$ReportArea',''], [], ['ctl00$cph$ReportViewer1$ctl10$ReportControl$ctl00',''], 90, 'ctl00');

That line always includes ReportViewer$Toolbar but there are 2 case where the Toolbar element does not exist:
1) when you've set ShowToolbar=False
2) when the ReportViewer is not yet bound to a report

My workaround is as MikeCarpenter described, I default the ReportViewer to Visible=False and only set it to visible after I bind the report to it.

MartynJones87 wrote Jun 3, 2010 at 2:33 PM

I'm getting the same issue, tried setting the ReportViewer to visible=false in the aspx and then only setting it to true when the ServerReport.ReportPath property has been set in the code behind.

Anyone else, any ideas?

Thanks very much.

ruddor wrote Aug 2, 2010 at 2:03 PM

I have similar situation. set visible to false works but not in case of ShowToolbar set to false. Is any workaround in case ShowToolbar=False?

MikeCarpenter wrote Aug 5, 2010 at 2:44 PM

I just checked...Im not setting the ShowToolbar to false...sorry.

ruddor wrote Aug 9, 2010 at 2:46 PM

Another workaround: I roll back to ReportViewer 9.0. It works. However, from time to time, you need to reset the Reserved.ReportViewerWebControl.axd from version 10.0 to 9.0 in web.config.

MSchuch wrote Aug 31, 2010 at 7:25 PM

I have the same problem when just turning off the report viewer toolbar. I worked around it by:
    ReportViewer1.ShowToolBar = True
    ReportViewer1.ShowExportControls = False
    ReportViewer1.ShowParameterPrompts = False
    ReportViewer1.ShowBackButton = False
    ReportViewer1.ShowExportControls = False
    ReportViewer1.ShowPageNavigationControls = False
    ReportViewer1.ShowPrintButton = False
    ReportViewer1.ShowRefreshButton = False
    ReportViewer1.ShowZoomControl = False
This acomplishes the look I need without generating the Javascript error. I guess everyone hates doing reports even the Microsoft Report Control team!

raphael0874 wrote Sep 13, 2010 at 8:29 PM

Has anyone found a solution for this issue?

I worked around this issue by setting debug="false" in the compilation section of my web.config.

kamranzahid wrote Sep 22, 2010 at 8:07 PM

any update on this? i am having the same exact problem.

mwstark wrote Oct 2, 2010 at 2:14 AM

for those that don't want to set debug="false" in the web.config for the entire site you can add ScriptMode="Release" to your ScriptManager to workaround the issue.

seiggy wrote Nov 17, 2010 at 8:54 PM

Encountered this issue as well...with some weird side effects while trying to solve it. The ScriptMode="Release" solved it, but here's the weirdness I encountered:

Was opening ReportViewer in it's own aspx page in a new window. I would then change the url to manually visit the report server. And view the report to verify it worked. Went back to relaunch window, and it loaded inside the iframe of the previous window (ok, so not too unexpected there)...from this point the report viewer worked fine...so weird.

itcouple wrote Dec 27, 2010 at 6:38 PM

Hi

I can confirm "MSchuch" solution worked for me as well. Setting toolbar to true removes the error. I suspect it has something to do with new Javascript API for ReportViewer 2010.

Regards
Emil

gui_vms wrote Jan 23, 2011 at 8:38 PM

Problem solved by changing the property of ScriptManager
<asp:ToolkitScriptManager ID="tsmAdmin" runat="server" EnablePartialRendering="false" />

zhunter wrote Feb 9, 2011 at 12:23 AM

I too am having the same problem. If there is not toolbar (report has no parameters) then there is no errors. If it has parameters (and a toolbar) there is always an error.

Here is the function call causing the error:
Sys.WebForms.PageLoadedEventArgs = function PageLoadedEventArgs(panelsUpdated, panelsCreated, dataItems)
/// <summary locid="M:J#Sys.WebForms.PageLoadedEventArgs.#ctor">The arguments for the PageRequestManager's pageLoaded event. The pageLoaded event is raised after the DOM has been updated.</summary>
/// <param name="panelsUpdated" type="Array">An array of UpdatePanels that were updated.</param>
/// <param name="panelsCreated" type="Array">An array of UpdatePanels that were created.</param>
/// <param name="dataItems" type="Object" mayBeNull="true"></param>
Here are the values for the panelsCreated, error specifically references pantelsCreated[1]
[0] = {object}
[1] = null
[2] = {object}
[4] = {object}

As you can see, panelsCreated expects to find a panel in position one but it's null.

Guruprasadv wrote Feb 23, 2011 at 3:12 PM

Same here... I need to show the report in UI, I can not set to Visibility = false.

I tried ToolBar = false. still the issue remains
I tried debug = false, the report is not rendering

Anyone else, any idea?

dear_tahir wrote Apr 20, 2011 at 1:42 PM

Set ScriptMode="Release" of your ScriptManager. It works for me

Happy Coding.

Tahir Akram
e-BizSoft Inc

GregR170 wrote May 26, 2011 at 12:13 PM

Same issue here. I can workaround to an extent by setting reportviewer visibility to false and then true in code behind after reportpath has been set.
However, the javascript error
Microsoft JScript runtime error: Sys.ArgumentNullException: Value cannot be null. Parameter name: panelsCreated[0]
recurs when switching report paremeters via drop down list (e.g. salesman) on the report viewer toolbar.
Running in release mode works, but is not ideal for development. A fix for this issue would be much appreciated.

AnilMadan wrote Dec 7, 2011 at 4:57 PM

Setting visibility to false did not solve this issue. Does any one have solution for this please

AnilMadan wrote Dec 7, 2011 at 5:01 PM

Set ScriptMode="Release" did not work for me. Any Solution please

slnit wrote Mar 1, 2012 at 5:06 PM

thanks dear_tahir it's work :), i only changed the propierty ScriptMode=release and then all works fine :P

Nageswararao521 wrote Mar 21, 2012 at 7:24 AM

Add ScriptMode = Release, I resolved my issue with the same