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.
Unfortunately, activation email could not send to your email. Please try again.

Not able to set ReportViewer label

Thread ID:

Created:

Updated:

Platform:

Replies:

129320 Mar 12,2017 01:36 PM Mar 20,2017 08:56 AM AngularJS 3
loading
Tags: ejReportViewer
Peter Horak
Asked On March 12, 2017 01:36 PM

I'm building an web application using AngularJS for the frontend and WebAPI (C#) for the backend.

I created an RDLC report with a boolean parameter called 'ShowPrevYear (see attached RDLC file). 

What I want to do is, hide some columns of my report depending on the value of the parameter ShowPrevYear. The user should be able to show/hide the report colums by selecting the corresponding option in the header of the report viewer.

To do this I created the following OnInitReportOptions() method in the report api controller:

        public void OnInitReportOptions(ReportViewerOptions reportOption)

        {

            //You can update report options here

            reportOption.ReportModel.ReportPath = reportPath + reportOption.ReportModel.ReportPath;

            reportOption.ReportModel.DataSources.Clear();

            reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "DataSetErgebnis", Value = GetDataEgebnis() });


            //Set report parameter programmaticaly

            List<ReportParameter> parameters = new List<ReportParameter>();

            parameters.Add(new ReportParameter() { Name = "ShowPrevYear", Labels = new List<string>() { "Ja", "Nein" }, Values = new List<string>() { "true", "false" } });

            reportOption.ReportModel.Parameters = parameters;

        }


When I show the report in the angularjs frontend the caption/label of the report parameter is always 'ReportParameter1' instead of 'ShowPrevYear' as expected (see attached JPG). I would like to set the parameters label to some meaningful to the user and I would like to localize the labels of the parameter options. How can I do this?


Attachment: tmp_ab1dceae.zip

Yuvaraj Devarajan [Syncfusion]
Replied On March 13, 2017 03:21 AM

Hi Peter, 

Thanks for contacting Syncfusion support. 

The Visual Studio RDLC designer doesn’t allow to create/edit the Report parameter labels (prompt name) in UI due to some RDLC compatibility. Hence the report parameter is displayed with the default name. To avoid this, you can manually add/edit the prompt node in RDLC definition file in XML view as shown in the below screenshot, 

 

For RDL: In ReportBuilder, you can able to modify the parameter name in Report Parameter property dialog box as shown in below screenshot, 
 

Please refer the below MSDN link for more detail, 

We have modified your shared RDLC file and prepared a sample which can be downloaded from below location, 

Regards, 
Yuvaraj D. 


Peter Horak
Replied On March 18, 2017 07:04 AM

Hi Yuvaraj,

thanks for your helpful reply. It nearly solves my problem. 

Now I am going to localize the report viewer control to german language. There I have another problem with the boolean report parameter. The default labels keep being displayed in english (Yes/No) instead of german (Ja/Nein). I attached a sample screen shot and my rdlc file.

How can I localize the these parameter value labels?

Regards Peter

Attachment: Reports_e7dd9b9.zip

Ravi Kumar Gurunathan [Syncfusion]
Replied On March 20, 2017 08:56 AM

Hi Peter, 
 
We have internally progressed the value of report parameters in an English language, so that we provided the localize only to an UI of reportviewer control and it will not change the display text of boolean report parameter, if we need to change that display text then we can customize it through script. In our control, we need to configure the “renderingcomplete” event trigger and then get the Html element to modify the display text of boolean report parameter as shown in below snap. 
 
 
 
 
Note: As per Report definition standard, the display text of report parameter will not be changed based on the localize. Please refer the below MSDN link for more detail, 
 
We have prepared a sample with your RDLC file which can be downloaded from below location,  
 
Regards, 
Ravi kumar G

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;