Skip to main content
A newer version of this page is available. .
All docs
V21.2

DxReportViewer.OnCustomizeToolbar Event

Allows you to customize the Report Viewer toolbar.

Namespace: DevExpress.Blazor.Reporting

Assembly: DevExpress.Blazor.Reporting.v21.2.Viewer.dll

NuGet Package: DevExpress.Blazor.Reporting.Viewer

Declaration

[Parameter]
public EventCallback<ToolbarModel> OnCustomizeToolbar { get; set; }

Parameters

Type Description
ToolbarModel

An object that contains a collection of toolbar items.

Remarks

Handle the OnCustomizeToolbar event to add a new toolbar item or hide the existing item.

Example: Customize the Toolbar

The following code hides the Export To drop-down list in the toolbar and adds a new item that allows you to refresh a document:

@using DevExpress.Blazor.Reporting.Models;
// ...
<DxReportViewer @ref="reportViewer" OnCustomizeToolbar="OnCustomizeToolbar"></DxReportViewer>

@code {
    DxReportViewer reportViewer;

    void OnCustomizeToolbar(ToolbarModel toolbarModel)
    {
        foreach (var item in toolbarModel.AllItems)
        {
            if (item.Id == "ExportTo")
            {
                item.GetEnabled = () => { return false; };
                item.Visible = false;
            }
        }

        toolbarModel.AllItems.Add(new ToolbarItem()
        {
            // Use Open Iconic's icon. 
            IconCssClass = "oi oi-reload",
            Text = "Reload",
            Click = (args) =>
            {
                reportViewer.ParametersModel.ApplyParameterValues();
                reportViewer.StartBuild();
                return Task.CompletedTask;
            }
        }); ;
    }
}

The customized toolbar is shown in the image below.

DxReportViewer Custom Toolbar

For more code samples review the following examples:

View Example: Report Viewer for Blazor - Customization API

View Example: Report Viewer for Blazor - Customize Export

See Also