Skip to main content

ASPxClientCardView.BatchEditEndEditing Event

Occurs when a grid leaves batch edit mode.


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.


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.


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.

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);
<dx:ASPxCardView ID="Grid" runat="server" KeyFieldName="ID" AutoGenerateColumns="False"
                 OnBatchUpdate="ASPxCardView1_BatchUpdate" OnCardDeleting="ASPxCardView1_CardDeleting" 
                 OnCardInserting="ASPxCardView1_CardInserting" OnCardUpdating="ASPxCardView1_CardUpdating" 
                 OnCustomUnboundColumnData="ASPxCardView1_CustomUnboundColumnData" >
    <ClientSideEvents BatchEditEndEditing="OnBatchEditEndEditing" />
    <SettingsEditing Mode="Batch" />
        <dx:CardViewSpinEditColumn FieldName="Quantity" >
            <PropertiesSpinEdit DisplayFormatString="g" />
        <dx:CardViewSpinEditColumn FieldName="Price" >
            <PropertiesSpinEdit DisplayFormatString="g" />
        <dx:CardViewTextColumn FieldName="Sum" ReadOnly="True" UnboundType="Decimal" />
            <dx:CardViewCommandLayoutItem HorizontalAlign="Right" ShowDeleteButton="True" 
                                          ShowEditButton="True" ShowNewButton="True">
            <dx:CardViewColumnLayoutItem ColumnName="Quantity" />
            <dx:CardViewColumnLayoutItem ColumnName="Price" />
            <dx:CardViewColumnLayoutItem ColumnName="Sum" />
            <dx:EditModeCommandLayoutItem HorizontalAlign="Right" />
protected List<GridDataItem> GridData {
        var key = "34FAA431-CF79-4869-9488-93F6AAE81263";
        if (!IsPostBack || Session[key] == null)
            Session[key] = Enumerable.Range(1, 100).Select(i => new GridDataItem
                ID = i,
                Quantity = i * 10 % 7 % i,
                Price = i * 0.5 % 3
        return (List<GridDataItem>)Session[key];
protected void Page_Load(object sender, EventArgs e) {
    Grid.DataSource = GridData;
protected void ASPxCardView1_BatchUpdate(object sender, DevExpress.Web.Data.ASPxDataBatchUpdateEventArgs e) {
    foreach (var args in e.InsertValues)
    foreach (var args in e.UpdateValues)
        UpdateItem(args.Keys, args.NewValues);
    foreach (var args in e.DeleteValues)
        DeleteItem(args.Keys, args.Values);

    e.Handled = true;
protected void ASPxCardView1_CardInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) {
protected void ASPxCardView1_CardUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) {
    UpdateItem(e.Keys, e.NewValues);
protected void ASPxCardView1_CardDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) {
    DeleteItem(e.Keys, e.Values);
protected void ASPxCardView1_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxCardViewColumnDataEventArgs e) {
    if (e.Column.FieldName == "Sum")
        decimal price = Convert.ToDecimal(e.GetListSourceFieldValue("Price"));
        int quantity = Convert.ToInt32(e.GetListSourceFieldValue("Quantity"));

        e.Value = price * quantity;
protected GridDataItem InsertNewItem(OrderedDictionary newValues) {
    var item = new GridDataItem() { ID = GridData.Count };
    LoadNewValues(item, newValues);
    return item;
protected GridDataItem UpdateItem(OrderedDictionary keys, OrderedDictionary newValues) {
    var id = Convert.ToInt32(keys["ID"]);
    var item = GridData.First(i => i.ID == id);
    LoadNewValues(item, newValues);
    return item;
protected GridDataItem DeleteItem(OrderedDictionary keys, OrderedDictionary values) {
    var id = Convert.ToInt32(keys["ID"]);
    var item = GridData.First(i => i.ID == id);
    return item;
protected void LoadNewValues(GridDataItem item, OrderedDictionary values) {
    item.Quantity = Convert.ToInt32(values["Quantity"]);
    item.Price = Convert.ToDouble(values["Price"]);
protected void CancelEditing(CancelEventArgs e) {
    e.Cancel = true;
public class GridDataItem {
    public int ID { get; set; }
    public int Quantity { get; set; }
    public double Price { get; set; }
See Also