1
votes

I have a parameterized SSRS report which is deployed to the server. Through the .NET application I have to pass the parameter and launch the report using the URL in an ASPX page. The parameter to the report is the USERID. It is 'Hidden' and 'Allow Null value' is checked. If the user is Admin (determined in .NET code itself), the USERID will be passed as NULL and if user is non-admin, then USERID is passed and the stored proc returns result set accordingly. Please guide how to achieve this?

Here is the link I currently have- https://ServerName/Pages/Report.aspx?ItemPath=%2fMy_Reports%2fMy_ReportName

1

1 Answers

0
votes

Check below code as i have to completed this same scenario but its in JQUERY you can convert in C# as well:

//If Userid = null then you have to pass parameter value "USERID:isnull=true"

//And when Userid should be numeric then parameter value "USERID=1" 

//For that i have added condition here

 var Userid = $("#Userid").val();
Userid == null ? Userid = ":isnull=true" : Userid = "=" + Userid; 

// And you report URL should be 

window.open('http://localhost/ReportServer_SQLEXPRESS/Pages/ReportViewer.aspx?YourReportName&rs:Command=Render&USERID' + Userid + '');

Its working for me !!