ASPxClientGridViewBatchEditApi.ValidateRowByKey(key) Method
Validates data in the specified row when the grid is in batch edit mode.
Declaration
ValidateRowByKey(
key: any
): boolean
Parameters
Name | Type | Description |
---|---|---|
key | any | The row’s key value. |
Returns
Type | Description |
---|---|
boolean |
|
Remarks
The ValidateRowByKey
method allows you to validate data in the specified row on the client side.
To validate all grid rows, call the ValidateRows method.
<dx:ASPxGridView ID="Grid" ClientInstanceName="ClientGrid" runat="server" ...>
<!-- ... -->
<SettingsEditing Mode="Batch">
<BatchEditSettings AllowValidationOnEndEdit="false" />
</SettingsEditing>
<ClientSideEvents BatchEditRowValidating="OnBatchEditRowValidating"/>
</dx:ASPxGridView>
<dx:ASPxButton ID="Button" runat="server" Text="Validate modified rows" AutoPostBack="false">
<ClientSideEvents Click="ValidateModifiedRows" />
</dx:ASPxButton>
function ValidateModifiedRows(s, e) {
var batchApi = ClientGrid.batchEditApi;
var modifiedRows = batchApi.GetUnsavedChanges().updatedValues;
// The GetUnsavedChanges method uses key values to identify updated rows
for (var rowKey in modifiedRows) {
batchApi.ValidateRowByKey(rowKey);
}
}
function OnBatchEditRowValidating(s, e) {
for (var columnIndex in e.validationInfo) {
var validationInfo = e.validationInfo[columnIndex];
if (validationInfo.value === null) {
validationInfo.isValid = false;
validationInfo.errorText = "Invalid data";
}
}
}
For more information on the grid in batch edit mode, refer to the following topic: ASPxGridView - Batch Edit Mode.
See Also