Back to Devexpress

DefaultClientControlContainer Class

xtrareports-devexpress-dot-xtrareports-dot-web-dot-clientcontrols-7961c3f4.md

latest6.5 KB
Original Source

DefaultClientControlContainer Class

A Dependency Injection container, sharing common services between the ASPxReportDesigner, ASPxWebDocumentViewer and ASPxQueryBuilder client controls.

Namespace : DevExpress.XtraReports.Web.ClientControls

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

NuGet Package : DevExpress.Web.Reporting.Common

Declaration

csharp
public static class DefaultClientControlContainer
vb
Public Module DefaultClientControlContainer

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 DefaultClientControlContainer.UseCustomGlobalizationService<T> method at the application startup.

csharp
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;
    }
}
vb
Imports System.Globalization
Imports System.Threading
Imports DevExpress.XtraReports.Web.ClientControls
' ...

Public Class CustomGlobalizationService
    Implements IGlobalizationService
    Public Sub UpdateCultures(userLanguagesFromClient As String())
        Dim currentCulture As CultureInfo = GetCultureInfo(userLanguagesFromClient)
        Thread.CurrentThread.CurrentCulture = currentCulture
        Thread.CurrentThread.CurrentUICulture = currentCulture
    End Sub
End Class

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

csharp
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>();
    // ...
}
vb
Imports DevExpress.XtraReports.Web.ClientControls
' Imports DevExpress.XtraReports.Web.QueryBuilder.Native
' Imports DevExpress.XtraReports.Web.WebDocumentViewer.Native
' Imports DevExpress.XtraReports.Web.ReportDesigner.Native
' ...

Sub Application_Start(ByVal sender As Object, ByVal e As System.EventArgs)
    ' QueryBuilderBootstrapper.SessionState = System.Web.SessionState.SessionStateBehavior.ReadOnly
    ' ReportDesignerBootstrapper.SessionState = System.Web.SessionState.SessionStateBehavior.ReadOnly
    ' WebDocumentViewerBootstrapper.SessionState = System.Web.SessionState.SessionStateBehavior.ReadOnly
    DefaultClientControlContainer.UseCustomGlobalizationService(Of CustomGlobalizationService)()
    ' ...
End Sub

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.

xml

  <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>



  <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>

Inheritance

Object DefaultClientControlContainer

See Also

DefaultClientControlContainer Members

DevExpress.XtraReports.Web.ClientControls Namespace