Skip to content

Create an unbound column that changes its values based on other column values dynamically in batch edit mode.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/asp-net-web-forms-gridview-calculate-values-dynamically-batch-mode

Repository files navigation

GridView for Web Forms - How to calculate values dynamically in batch edit mode

This example demonstrates how to create an unbound column (Sum) that changes its values based on other column values dynamically in batch edit mode.

Grid View - Modified values

Set the unbound column's ShowEditorInBatchEditMode property to false to make the column read-only in batch edit mode.

<dx:GridViewDataTextColumn FieldName="Sum" UnboundType="Decimal" ReadOnly="true">
    <Settings ShowEditorInBatchEditMode="false" />
</dx:GridViewDataTextColumn>

Handle the client BatchEditEndEditing event to recalculate column values based on the changes and call the SetCellValue method to set the new column value.

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, null, true);
    }, 0);
}

Files to Look At

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Create an unbound column that changes its values based on other column values dynamically in batch edit mode.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •