Skip to main content
All docs
V25.1
  • DxReportViewer.ShouldDisposeReport Property

    Specifies whether a report should be disposed of when the Report Viewer is closed.

    Namespace: DevExpress.Blazor.Reporting

    Assembly: DevExpress.Blazor.Reporting.v25.1.Viewer.dll

    NuGet Package: DevExpress.Blazor.Reporting.Viewer

    Declaration

    public bool ShouldDisposeReport { get; set; }

    Property Value

    Type Description
    Boolean

    true to dispose of the report when the viewer is closed; otherwise, false.

    Remarks

    The ShouldDisposeReport setting determines whether the report is disposed of when the viewer is closed. The default value is true.

    The ShouldDisposeReport property is not marked with the [Parameter] attribute, so you cannot set it in Razor markup. To change this property, use a component reference and assign the value in code.

    The following code snippet sets the ShouldDisposeReport property to false and prevents the report from being disposed of when the viewer is closed. When you set this property to false, you should manually dispose of the report to avoid memory leaks:

    @page "/"
    
    <DxReportViewer @ref="reportViewer" Report="@Report" />
    
    @code {
        DxReportViewer reportViewer;
        XtraReport Report = new XtraReport1();
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);
            if (reportViewer != null) reportViewer.ShouldDisposeReport = false;
        }
    
        public void Dispose() {
            Report.Dispose();
            Report = null;
        }
    }
    
    See Also