简体   繁体   中英

Strange behaviour of SSRS parameters when comparing Report Builder and Report Viewer

SQL SERVER 2008 R2 SQL SERVER REPORTING SERVICES Report Builder 3.0 Visual Studio 2010 ASP.NET/C#

I design .rdl reports in Report Builder and deploy them on a SharePoint site. The bulk of the data are retrieved from SQL Server via Stored Procedures, most of which take parameters. The parameters are shown at the top of the report.

Most users consume the report in the ASP.NET application using a ReportViewer control.

        <rsweb:ReportViewer ID="rvResults" runat="server"  
            ProcessingMode="Remote"
            BackColor="#F5F6F7" ShowZoomControl="true" 
            ShowPrintButton="true" SizeToReportContent="true" ZoomMode="FullPage"
            ShowDocumentMapButton="true" ShowFindControls="true" ShowPageNavigationControls="true"
            ShowPromptAreaButton="False" InternalBorderColor="#ACBBD8">
        </rsweb:ReportViewer>

When I run the report, either from within Report Builder or from SharePoint, everything works as expected. The parameters are shown at the top (or side) of the report, and the user can enter values (which come mainly from drop-downs using datasets populated either by Stored Procedures or via embedded SQL). Some drop-down lists are cascading - ie the value in list 2 is dependent on the value selected in list 1.

When I run the report from within the ASP.NET application, there are two issues. First, I get a script error:

Line: 157 Error: Sys.ArgumentNullException: Value cannot be null. Parameter name: panelsCreated 1

I have set certain parameters in the report to be NULLABLE and to take default values of NULL, as the correct operation of the report requires it.

Second, selecting a value from a drop-down list makes all the parameter values disabled, and makes the report unusable. The two images below show this.

REPORT PARAMETERS FROM REPORT BUILDER (works correctly) 在此处输入图片说明

REPORT PARAMETERS FROM ASP.NET APPLICATION (doesn't work correctly) 在此处输入图片说明

Careful readers might note that the value displayed in the Secondary Status ID control is different in both. In the first, correct version, it shows , whereas in the second it shows . The SQL used to populate the control is as follows:

SELECT Null AS ID, '<All>' AS Name
UNION
Select Distinct ID, Name
from lutRequestStatusSecondary
Where FKRequestTypeID=1
AND Deleted=0
AND FKStatusID=@StatusID
Order by Name

I set ScriptMode="Release" in the ScriptManager of the Master page. I'm not sure why it had stopped working (nor why an older release is still working!) but this is at least one of the answers (another which worked was setting AsyncRendering=False on the ReportViewer control).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM