We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Internal Report Parameters Dotnet core

Hello,
I have successfully integrated Report Dedesigner and Report Viewer in Asp.net Core. I am testing a very simple report and all works well without parameters. With parameters when the visibility is set to true it works and I can select the parameter value form, a combobox at runtime. My problem is that I want to supply the parameter dynamically when someone clicks a link for example, i tried "hidden" parameter but I get an error "Hidden report parameters ProcessId is missing a value. Report cannot be rendered"
my parameter is called "ProcessId" it is properly defined in the RDL like so:

 
   
      Integer
     
      true
   

 


my view is defined as so:



and finally in my WebAPI i have the following code:

   public void OnReportLoaded(ReportViewerOptions reportOption)
        {
            var parameters = new List();
            if (DefaultParam != null)
            {
                parameters = JsonConvert.DeserializeObject>(DefaultParam);
            }

            if (parameters != null && parameters.Count > 0)
            {
                reportOption.ReportModel.DataSources.Clear();
                reportOption.ReportModel.DataSources.Add(new Syncfusion.Reporting.Web.ReportDataSource { Name = "ProcessId", Value = 91 });
             
            }
        }

where I harcoded the ProcessId to 91 for testing purposes, I will likely use a session variable in real life. Despite this I still get the error message  above about hidden report parameter missing,  Please what am I missing? I repeat report without parameters is ok and with visible parameters ius also ok.

Thanks in advance for your usual prompt response.






4 Replies

YY Yoab Youssoufou August 11, 2019 01:06 PM

The code did not render well in my text above so I have attached screenshots of my view, RDL file and WebApi.
Thanks

Attachment: ReportParamError_f2af2fa.7z


VS Vinoth Srinivasan Syncfusion Team August 12, 2019 01:09 AM

Hi Yoab, 

We have validated your code snippet and suspect that you are not passing value for the hidden parameter from code behind properly. We suggest you to refer the below help documentation for passing parameters from code behind. 


If you still have any issue then please share your RDL file with us, it will be helpful for us in further validation. 

Regards, 
Vinoth S. 



YY Yoab Youssoufou August 12, 2019 04:03 AM

Thanks. It's ok now.


VS Vinoth Srinivasan Syncfusion Team August 12, 2019 05:49 AM

Hi Yoab, 

Thanks for your update. Please let us know if you require further assistance on this. 

Regards, 
Vinoth S. 


Loader.
Live Chat Icon For mobile
Up arrow icon