Skip to main content
All docs
V18.2

ASPxClientWebDocumentViewer.PreviewClick Event

Occurs when the left mouse button is clicked on a report document.

Namespace: DevExpress.XtraReports.Web.Scripts

Assembly: DevExpress.XtraReports.v18.2.Web.Scripts.dll

Declaration

public event ASPxClientWebDocumentViewerPreviewClickEventHandler PreviewClick

Event Data

The PreviewClick event's data class is ASPxClientPreviewClickEventArgs. The following properties provide information specific to this event:

Property Description
Brick Provides information on a visual brick representing content of a report control that has been clicked.
Handled Specifies whether or not the event was handled and no default processing is required.
PageIndex Gets a value specifying the zero-based index of the page that has been clicked.

The event data class exposes the following methods:

Method Description
DefaultHandler() Specifies the default function used to handle the ASPxClientWebDocumentViewer.PreviewClick event.
GetBrickText() Returns the text displayed by the ASPxClientPreviewClickEventArgs.Brick.
GetBrickValue() Returns a string providing additional information on the ASPxClientPreviewClickEventArgs.Brick.
GetBrickValue(String) Returns a string providing additional information about the current ASPxClientPreviewClickEventArgs.Brick by the specified key.

Remarks

Handle the PreviewClick event to perform different actions when an end-user clicks the report document opened in the Web Document Viewer. You can obtain a text displayed by the corresponding report element using the ASPxClientPreviewClickEventArgs.GetBrickText method and additional brick information (the XRControl.Tag property value) using the ASPxClientPreviewClickEventArgs.GetBrickValue method.

The following code snippet demonstrates how to obtain the text of an element that has been clicked.

<script type="text/javascript" id="script">
    function previewClick(s, e) {
        e.Brick && alert(e.Brick.text())
    }
</script>

<dx:ASPxWebDocumentViewer ID="ASPxWebDocumentViewer1" runat="server" ReportSourceId="WebReportDesigner.XtraReport1">
     <ClientSideEvents PreviewClick="previewClick"/>
</dx:ASPxWebDocumentViewer>

The example below illustrates how to ask the user to confirm an operation related to expanding/collapsing data in a drill-down report and navigating to an URL. The ASPxClientWebDocumentViewerBrick.navigation property provides access to a brick’s navigation settings. Use the ASPxClientPreviewClickEventArgs.Handled property to specify whether or not default processing (specified by the ASPxClientPreviewClickEventArgs.DefaultHandler function) is required, depending on the confirmation result.

<script type="text/javascript" id="script">
    function previewClick(s, e) {
        if (!e.Brick)
            return
        var navigation = e.Brick.navigation;
        if (navigation) {
            var ok = true;
            if (navigation.drillDownKey) {
                ok = confirm('Are you sure you want to expand/collapse data?');
            } else if (navigation.url) {
                ok = confirm('Are you sure you want to navigate to the following URL: ' + navigation.url);
            }
            e.Handled = !ok;
        }
    }
</script>

<dx:ASPxWebDocumentViewer ID="ASPxWebDocumentViewer1" runat="server" ReportSourceId="WebReportDesigner.XtraReport1">
     <ClientSideEvents PreviewClick="previewClick"/>
</dx:ASPxWebDocumentViewer>
See Also