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

ASPxClientGridView.BatchEditRowInserting Event

Occurs on the client side before a data row is inserted in batch edit mode.

Declaration

BatchEditRowInserting: ASPxClientEvent<ASPxClientGridViewBatchEditRowInsertingEventHandler<ASPxClientGridView>>

Event Data

The BatchEditRowInserting event's data class is ASPxClientGridViewBatchEditRowInsertingEventArgs. 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.
visibleIndex Gets the processed row’s visible index.

Remarks

The ASPxGridView control allows you to modify a batch of grid data on the client side and send it to the server in a single request.

The BatchEditRowInserting event occurs when an end-user has clicked the New command button. The event argument properties allow you to obtain the processed row by its visible index (visibleIndex). To cancel the current operation, set the event parameter’s cancel property to true.

Example

The following example illustrates how to use the BatchEditRowInserting event.

function OnBatchEditRowInserting(s, e) {
    CheckSelectedCellsOnPage("insertCheck");
}
function CheckSelectedCellsOnPage(checkType) {
    var currentlySelectedRowsCount = 0;
    var visibleIndices = Grid.batchEditApi.GetRowVisibleIndices();
    var totalRowsCountOnPage = visibleIndices.length;
    for (var i = 0; i < totalRowsCountOnPage ; i++) {
        if (Grid.batchEditApi.GetCellValue(visibleIndices[i], "Discontinued"))
            currentlySelectedRowsCount++;
        }
        if (checkType == "insertCheck")
            totalRowsCountOnPage++;
        else if (checkType == "deleteCheck") {
            totalRowsCountOnPage--;
            if (DeletedValue)
                currentlySelectedRowsCount--;
        }
        if (currentlySelectedRowsCount <= 0)
            HeaderCheckBox.SetCheckState("Unchecked");
        else if (currentlySelectedRowsCount >= totalRowsCountOnPage)
            HeaderCheckBox.SetCheckState("Checked");
        else
            HeaderCheckBox.SetCheckState("Indeterminate");
}
See Also