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 handler receives an argument of the ASPxClientGridViewBatchEditRowInsertingEventArgs type. 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)
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