Skip to main content
A newer version of this page is available. .

ASPxClientCardView.BatchEditConfirmShowing Event

Enables you to prevent a batch edit confirmation message from being displayed.

Declaration

BatchEditConfirmShowing: ASPxClientEvent<ASPxClientCardViewBatchEditConfirmShowingEventHandler<ASPxClientCardView>>

Event Data

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

Property Description
cancel Gets or sets a value indicating whether the action which raised the event should be canceled. Inherited from ASPxClientCancelEventArgs.
requestTriggerID Gets the client identifier of an object that initiates a send request.

Remarks

In batch edit mode, if the GridBatchEditSettings.ShowConfirmOnLosingChanges property is true (the default behavior), a confirmation dialog is displayed when a grid page contains modified values and an end-user tries to send a request, for instance to sort grid data. The BatchEditConfirmShowing event occurs before displaying this confirmation dialog and allows you to cancel its display, if required.

For instance, you may want to prevent the batch edit confirmation dialog from being displayed, if you place the ASPxCardView into an ASPxCallbackPanel together with other controls (such as ASPxTabControl, ASPxButton, etc.), and some of these controls (but not the ASPxCardView) initiate the panel update by calling the ASPxCallbackPanel’s ASPxClientCallbackPanel.PerformCallback client method. In this case, you can set a client flag in the initiator control’s client event handler, and then analyze this flag within a handler of the BatchEditConfirmShowing event. The event argument’s ASPxClientCardViewBatchEditConfirmShowingEventArgs.requestTriggerID property will give you the ID of the ASPxCallbackPanel whose PerformCallback client method has been called. In the event handler, you can set the ASPxClientCancelEventArgs.cancel property to true to prevent display of the grid confirmation dialog.


function Grid_BatchEditConfirmShowing(s, e) {
    if(e.requestTriggerID === "MyCallbackPanel" && myFlag)
        e.cancel = true;
}

Example

This example demonstrates how to create an unbound column that calculates the sum of other columns and changes its values on the fly when an end-user changes any grid values using the Batch edit mode.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register assembly="DevExpress.Web.v15.2, Version=15.2.11.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web" tagprefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function OnBatchEditEndEditing(s, e) {
            window.setTimeout(function () {
                var price = s.batchEditApi.GetCellValue(e.visibleIndex, "Price");
                var quantity = s.batchEditApi.GetCellValue(e.visibleIndex, "Quantity");
                s.batchEditApi.SetCellValue(e.visibleIndex, "Sum", price * quantity);
            }, 10);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <dx:ASPxCardView ID="Grid" runat="server" KeyFieldName="ID" OnBatchUpdate="ASPxCardView1_BatchUpdate" 
            OnCardInserting="ASPxCardView1_CardInserting" OnCardUpdating="ASPxCardView1_CardUpdating" OnCardDeleting="ASPxCardView1_CardDeleting"             
            OnCustomUnboundColumnData="ASPxCardView1_CustomUnboundColumnData" AutoGenerateColumns="False">
            <ClientSideEvents BatchEditEndEditing="OnBatchEditEndEditing" />
            <SettingsEditing Mode="Batch">
            </SettingsEditing>
            <Columns>
                <dx:CardViewSpinEditColumn FieldName="Quantity" VisibleIndex="0">
                    <PropertiesSpinEdit DisplayFormatString="g">
                    </PropertiesSpinEdit>
                </dx:CardViewSpinEditColumn>
                <dx:CardViewSpinEditColumn FieldName="Price" VisibleIndex="1">
                    <PropertiesSpinEdit DisplayFormatString="g">
                    </PropertiesSpinEdit>
                </dx:CardViewSpinEditColumn>
                <dx:CardViewTextColumn FieldName="Sum" ReadOnly="True" UnboundType="Decimal" VisibleIndex="2">
                </dx:CardViewTextColumn>
            </Columns>
            <CardLayoutProperties>
                <Items>
                    <dx:CardViewCommandLayoutItem HorizontalAlign="Right" ShowDeleteButton="True" ShowEditButton="True" ShowNewButton="True">
                    </dx:CardViewCommandLayoutItem>
                    <dx:CardViewColumnLayoutItem ColumnName="Quantity">
                    </dx:CardViewColumnLayoutItem>
                    <dx:CardViewColumnLayoutItem ColumnName="Price">
                    </dx:CardViewColumnLayoutItem>
                    <dx:CardViewColumnLayoutItem ColumnName="Sum">
                    </dx:CardViewColumnLayoutItem>
                    <dx:EditModeCommandLayoutItem HorizontalAlign="Right">
                    </dx:EditModeCommandLayoutItem>
                </Items>
            </CardLayoutProperties>
        </dx:ASPxCardView>

    </div>
    </form>
</body>
</html>
See Also