DxReportViewer.OnPreviewClick Event
Occurs when a user clicks a report document.
Namespace: DevExpress.Blazor.Reporting
Assembly: DevExpress.Blazor.Reporting.v25.2.Viewer.dll
NuGet Package: DevExpress.Blazor.Reporting.Viewer
Declaration
Parameters
| Type | Description |
|---|---|
| PreviewClickEventArgs | The event data. |
Remarks
The following code snippet handles the OnPreviewClick event. The sample report contains two labels (“Label 1” and “Label 2”). The Clicked variable displays the clicked label caption or “Empty area”. When “Label 2” is clicked, the Handled property is set to true to prevent any default actions.
@using DevExpress.Blazor.Reporting.Models
@using DevExpress.XtraReports.UI
@using DxBlazorApplication.PredefinedReports
<div>Clicked: @Clicked</div>
<DxReportViewer Report="@Report"
OnPreviewClick="OnPreviewClick"/>
@code {
private string? Clicked;
XtraReport Report = new TestReport(); // Contains "Label 1" and "Label 2"
private async Task OnPreviewClick(PreviewClickEventArgs args) {
if (args.Brick is null) {
Clicked = "Empty area";
return;
}
else if (args.Brick.Text == "Label 1") {
Clicked = "First Label";
return;
}
else if (args.Brick.Text == "Label 2") {
Clicked = "Second Label";
args.Handled = true;
return;
}
await Task.CompletedTask;
}
}
See Also