Pass culture info from report viewer to server

2 posts, 1 answers
  1. Yujie
    Yujie avatar
    1 posts
    Member since:
    Nov 2015

    Posted 28 May Link to this post

    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

  2. Answer
    Todor
    Admin
    Todor avatar
    310 posts

    Posted 31 May Link to this post

    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
Back to Top