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

Pass culture info from report viewer to server

1 Answer 210 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Yujie
Top achievements
Rank 1
Yujie asked on 29 May 2019, 04:33 AM

How do I pass culture info from client to server? I'm using the js library to initialize the report viewer (telerik_ReportViewer).

I had a look the doc here here but I don't see how this can be passed to the server.

 

I want to pass the culture info to the reporting service so that I can set the culture of the running thread correctly.

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 31 May 2019, 03:50 PM
Hello Yujie,

I noticed that you have opened a Support ticket on the issue. I have answered the questions there. For the benefit of the community I will summarize the discussion also here :

The culture may be passed in the device info settings when using the Reporting REST API. We do not expose a property for setting the device info settings in the Html5 Report Viewer. A workaround may be found in the How to pass culture via AJAX call from the HTML5 Report Viewer KB article. Basically, on the $.ajaxPrefilter event you should intercept the request for creating the document and modify its device info settings to provide the needed culture. The code may look like :

$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
    var str = originalOptions.url;
    var documentsSuffix = "documents";
    var isDocumentsUrl = (str.indexOf(documentsSuffix) == str.length - documentsSuffix.length);
    if (isDocumentsUrl) {
        var d = JSON.parse(originalOptions.data);
        d.deviceInfo["CurrentCulture"] = YourCultureHere;
        d.deviceInfo["CurrentUICulture"] = YourCultureHere;
        options.data = JSON.stringify(d);
    }
});

The Report Localized with YourCultureHere would be automatically rendered in this culture by the REST Service.

Regards,
Todor
Progress Telerik
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
Yujie
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or