This is a migrated thread and some comments may be shown as answers.

asp.net Localization report (how to pass the lang ?)

4 Answers 272 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jean
Top achievements
Rank 1
Jean asked on 18 Apr 2017, 03:13 PM

Hi,

We have a web application stateless, to pass the lang, all of the url of application are in the format (/xx/api/controller (xx = fr | nl | ...) (and we have a "filter" to change the CurrentUICulture based on this).

We try to use the Html.TelerikReporting().ReportViewer() (Asp.net Mvc ReportViewer) but we can not pass the lang from the client to the server side, the url of your service is like /api/reports/** and we can not change this or alter this to add parameter), thus how to pass the language ?

<globalization culture="auto" uiCulture=auto” /> is not viable because the client can change at any time the language.

-----

I have even a badder case, for one report, the language is a report parameter for a pratical reason  ! But you can not change the language in NeedDataSource, because it is too late, but before  InitializeComponent, it is too early because no parameters ? How do to that ?

I googled, i searched on the forum, but nothing ?!. I was so easy with web form because we can intercept the creation of the report but here i do not find the way to intercept the creation and alter the culture ?

 

Thanks for any help.

4 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 18 Apr 2017, 03:54 PM
Hello Fabrice,

Please check my posts in the Report Viewer Filter Section Date Format forum thread. The example attached to my post illustrates how to get the currently selected language from the client and to use it on sending a request to the server to change the current thread's culture.

I hope this helps.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jean
Top achievements
Rank 1
answered on 18 Apr 2017, 03:56 PM

The main problem is the key localization to search, i find some usefull post to help :

http://www.telerik.com/support/kb/reporting/details/how-to-change-reporting-rest-web-api-routes-registered-by-default

http://stackoverflow.com/questions/23955484/how-can-i-pass-parameters-to-the-reportsource-that-on-the-web-api-service

and why not webform !

0
Jean
Top achievements
Rank 1
answered on 19 Apr 2017, 03:29 PM

Sure another way, a cookie, it is a good option, i prefer to register telerik web api with /xx/api/Reports, it is like the rest of our application.

It does not resolve the problem when the lang is a parameter of the report ! For now, people need to change the language of the application to have the report in the good language ! I think i can change the serviceUrl in javascript but i need to find the good event to do that, even in this case, it is "hack". The only way seems to use a custom resolver but because parameter are not transfered, you need to encode the report name => a lot of work for 3 reports generated each month ;)

0
Stef
Telerik team
answered on 20 Apr 2017, 10:22 AM
Hello Fabrice,

You can change the routes of the Reporting REST service to avoid duplicating routes of other standard and WebAPi controllers in the application. If you need to handle information sent through the URL, our recommendation is to extend other standard controllers' methods and routes, where you can save the selected culture and pass it to the server where reports are processed and rendered.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Jean
Top achievements
Rank 1
Answers by
Stef
Telerik team
Jean
Top achievements
Rank 1
Share this question
or