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
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

How do I programmatically override parameters for the JavaScript ReportViewer on the server?

I have a report that are available to multiple customers for data in their company. As such, the report takes a tenant Id. Needless to say, I do not want customers to be able to see the report for any data other than for their company. To do this, the report takes a tenant Id that is stored in a server session variable.

How do I pass a tenant Id to the report viewer (JavaScript) without the user being able to override it?

I tried overriding the API Controller's OnReportLoaded as follows:
public void OnReportLoaded(ReportViewerOptions reportOptions)
{
            reportOptions.ReportModel.Parameters = new List<ReportParameter> {
                new ReportParameter {
                    Name = "TenantId",
                    Values = new List<string> {"1000"},
                }
            };
        }

This only works if the parameter is visible, which means that the user is able to override the parameter value.

-Waldemar


3 Replies

VT Vignesh Tamil Selvan Syncfusion Team March 10, 2015 06:23 AM UTC

Hi Waldemar,

Thanks for using Syncfusion products.

                    Query

                                Response

How do I pass a tenant Id to the report viewer (JavaScript) without the user being able to override it?

I tried overriding the API Controller's OnReportLoaded as follows:

                        public void OnReportLoaded(ReportViewerOptions reportOptions)

                        {

            reportOptions.ReportModel.Parameters = new List<ReportParameter> {

                new ReportParameter {

                    Name = "TenantId",

                    Values = new List<string> {"1000"},

                }

            };

        }

ReportViewer has support to set parameters in either  JavaScript and API Controller’s overloads.

Please refer our online document for more details.

http://help.syncfusion.com/ug/js/documents/reportparameters.htm

This only works if the parameter is visible, which means that the user is able to override the parameter value.

This is a known bug and we request you to create a Support Ticket in our DirectTrack support system to get a solution or more details about this bug.

Please log into DirectTrac support system to create a new support ticket.

Please let us know if you have any questions.

Regards,

Vignesh T




WS Waldemar Sauer April 13, 2015 10:10 PM UTC

The hidden parameters feature is now working nicely in Essential Studio 2015 Volume 1.

Thank you,
-Waldemar



SR Soundara Rajan S Syncfusion Team April 14, 2015 04:42 AM UTC

Hi Waldemar,

Thanks for your update. Please let us know, if you need any further assistance on this?.

Regards,
Soundara Rajan S.

Loader.
Live Chat Icon For mobile
Up arrow icon