Wednesday, July 20, 2011

ReportViewer: Another Reason to “Sys.ArgumentNullException: Value cannot be null. Parameter name: panelsCreated[..]”

If you are stuck with a blank screen when using the ReportViewer control that ships with Visual Studio 2010, check if you provided values for all the parameters in the report. We created a report using {CTRL+C CTRL+V} on an existing report, and the second report used only 3 of the 4 parameters on the original report. We did not provide any value to the last parameter, and it had no default value configured, so the ReportViewer rendered a blank panel on the web form, and generated the following JavaScript error:

Sys.ArgumentNullException: Value cannot be null. Parameter name: panelsCreated[1]

When we edited the report's RDLC file (I could not find the "Report Parameters" menu option that should be under the “Report” menu in Visual Studio, so I opened the RDLC file using Visual Studio XML Editor), and took off the unused parameter defition, the ReportViewer rendered ok. Thanks to this post for pointing me to the right direction.