Skip to main content
All docs
V25.1
  • .NET 8.0+

    IReportDataSourceHelper.CustomSetSorting Event

    Occurs when sorting is applied to the report data source.

    Namespace: DevExpress.ExpressApp.ReportsV2

    Assembly: DevExpress.ExpressApp.ReportsV2.v25.1.dll

    Declaration

    event EventHandler<CustomSetSortingEventArgs> CustomSetSorting

    Event Data

    The CustomSetSorting event's data class is DevExpress.ExpressApp.ReportsV2.CustomSetSortingEventArgs.

    Remarks

    Handle this event to apply sorting in a custom manner. The code snippets below demonstrate how to subscribe to this event:

    In Application Builder Code

    In the application’s Startup.cs file, add the OnCustomSetSorting event handler to the builder.Modules.AddReports method call as shown below:

    File: MySolution.Blazor.Server/Startup.cs, MySolution.Win/Startup.cs, MySolution.WebApi/Startup.cs

    using DevExpress.ExpressApp.ApplicationBuilder;
    // ...
    builder.Modules
        .AddReports(options => {
            // ...
            options.Events.OnCustomSetSorting = context => {
                // ...
            };
        })
    // ...
    

    Through Dependency Injection

    Note

    The technique shown in this section is not supported for Web API Service.

    Use Dependency Injection to access the IReportDataSourceHelper service and add a handler to its CustomSetSorting event.

    using DevExpress.ExpressApp.ReportsV2;
    using Microsoft.Extensions.DependencyInjection;
    // ...
    // Use Dependency Injection to access the IServiceProvider.
    var helper = serviceProvider.GetRequiredService<IReportDataSourceHelper>();
    helper.CustomSetSorting += delegate (object sender, CustomSetSortingEventArgs e) {
        // ...
    };
    
    See Also