Skip to main content

DefaultClientControlContainer.UseCustomGlobalizationService<T>(T) Method

Registers the specified custom globalization service instance.

Namespace: DevExpress.XtraReports.Web.ClientControls

Assembly: DevExpress.XtraReports.v24.2.Web.dll

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public static void UseCustomGlobalizationService<T>(
    T globalizationService
)
    where T : IGlobalizationService

Parameters

Name Type Description
globalizationService T

An object implementing the IGlobalizationService interface.

Type Parameters

Name
T

Remarks

When a web server processes requests coming from the Query Builder, End-User Report Designer or Web Document Viewer, a full page postback does not occur, which enables faster processing of such requests.

To register a custom globalization service, provide a custom IGlobalizationService implementation and register it by calling the UseCustomGlobalizationService<T> method at the application startup.

using System.Globalization;
using System.Threading;
using DevExpress.XtraReports.Web.ClientControls;
// ...

public class CustomGlobalizationService : IGlobalizationService {
    public void UpdateCultures(string[] userLanguagesFromClient) {
        CultureInfo currentCulture = GetCultureInfo(userLanguagesFromClient);
        Thread.CurrentThread.CurrentCulture = currentCulture;
        Thread.CurrentThread.CurrentUICulture = currentCulture;
    }
}

You can register your globalization service using the UseCustomGlobalizationService<T> method at the applicaton startup.

using DevExpress.XtraReports.Web.ClientControls;
// using DevExpress.XtraReports.Web.QueryBuilder.Native;
// using DevExpress.XtraReports.Web.WebDocumentViewer.Native;
// using DevExpress.XtraReports.Web.ReportDesigner.Native;
// ...

protected void Application_Start(object sender, System.EventArgs e)
    // QueryBuilderBootstrapper.SessionState = System.Web.SessionState.SessionStateBehavior.ReadOnly;
    // ReportDesignerBootstrapper.SessionState = System.Web.SessionState.SessionStateBehavior.ReadOnly;
    // WebDocumentViewerBootstrapper.SessionState = System.Web.SessionState.SessionStateBehavior.ReadOnly;
    DefaultClientControlContainer.UseCustomGlobalizationService<CustomGlobalizationService>();
    // ...
}

If you are using the ASP.NET session state in your application, assign an appropriate value to the static SessionState property of the required bootstrapper classes.

Additionally, to be able to access the session state from your IGlobalizationService implementation, add the following lines to the application’s configuration file.

<system.web>
  <httpHandlers>
    <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v16.2, Version=16.1.0.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="DXXRDV.axd" validate="false" />
    ...
  </httpHandlers>
</system.web>

<system.webServer>
  <handlers>
    <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v16.2, Version=16.1.0.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="DXXRDV.axd" name="ASPxViewerHttpHandlerModule" preCondition="integratedMode" />
    ...
  </handlers>
</system.webServer>
See Also