ASPxClientCardView.BatchEditEndEditing Event

Occurs when a grid leaves batch edit mode.

Declaration

BatchEditEndEditing: ASPxClientEvent<ASPxClientCardViewBatchEditEndEditingEventHandler<ASPxClientCardView>>

Event Data

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

Property Description
cancel Specifies whether to cancel the related action (for example, row edit, export). Inherited from ASPxClientCancelEventArgs.
cardValues Gets a hashtable that maintains information about editable cells.
focusedColumn Gets the column to which the edited cell belongs.
visibleIndex Gets the visible index of the card whose cells have been edited.

Remarks

The BatchEditEndEditing event is raised when the grid leaves edit mode (for a cell/card) due to an end-user interaction or programmatic call to the ASPxClientCardViewBatchEditApi.EndEdit method. The event provides arguments that allow you to leave a particular cell in the edit mode.

An argument object provided by the events contains the ASPxClientCardViewBatchEditEndEditingEventArgs.cardValues structure. This is a hashtable that maintains information about editable cells in the following manner:

cardValues = {
   "0": {
      value: "someValue",
      text: "someDisplayText"
   }
}
//Here, "0" is an example of the column index specifying the corresponding card cell

You can manipulate entries of this hashtable to initialize/modify editor values or prevent displaying editors for particular cells by removing the corresponding entries from ASPxClientCardViewBatchEditEndEditingEventArgs.cardValues.

Note that if the CardViewBatchEditSettings.EditMode property is set to Cell, the ASPxClientCardViewBatchEditEndEditingEventArgs.cardValues hashtable contains all values of an edited card, but only the value of an edited cell is used to update the card. The edited cell is specified by the ASPxClientCardViewBatchEditStartEditingEventArgs.focusedColumn property passed to the ASPxClientCardView.BatchEditStartEditing event.

Examples

The following example creates an unbound column that calculates the sum of other columns and changes its values dynamically when an end-user changes a grid value in Batch edit mode.

View Example

<%@ 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