ASPxClientControlCollection.ValidationCompleted Event
Occurs after the validation initiated for a DevExpress web control (or a group of DevExpress web controls) has been completed.
Declaration
ValidationCompleted: ASPxClientEvent<ASPxClientValidationCompletedEventHandler<ASPxClientControlCollection>>
Event Data
The ValidationCompleted event's data class is ASPxClientValidationCompletedEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
container | Gets a container object that holds the validated control(s). |
firstInvalidControl | Gets the first control (either visible or invisible) that hasn’t passed the validation applied. |
firstVisibleInvalidControl | Gets the first visible control that hasn’t passed the validation applied. |
invisibleControlsValidated | Gets a value that indicates whether validation has been applied to both visible and invisible controls. |
isValid | Gets a value specifying whether the validation has been completed successfully. |
validationGroup | Gets the name of the validation group name to which validation has been applied. |
Remarks
Each time validation is initiated for a DevExpress web control or a group of DevExpress web controls is completed, the ValidationCompleted event is generated. This event fires after all ASPxClientEdit.Validation client events of the validated DevExpress web controls.
A handler of the ValidationCompleted event is a suitable place to find out whether all DevExpress web controls have passed the validation (by analyzing the ASPxClientValidationCompletedEventArgs.isValid property). You can access the first control that failed the validation (by using the ASPxClientValidationCompletedEventArgs.firstInvalidControl or ASPxClientValidationCompletedEventArgs.firstVisibleInvalidControl property), obtain the container of the validated controls (ASPxClientValidationCompletedEventArgs.container) or the name of their validation group (ASPxClientValidationCompletedEventArgs.validationGroup).
For instance, the ValidationCompleted event might be helpful if you validate editors located in different tab pages of the ASPxPageControl and need to move input focus to an invalid editor within a non-active tab page.
ASPxClientControl.GetControlCollection().ValidationCompleted.AddHandler(function (s, e) {
if(e.isValid && Password.GetValue() != ConfirmedPassword.GetValue()) {
ConfirmedPassword.SetFocus();
ErrorMessageNotEqual.SetVisible(true);
e.isValid = false;
} else
ErrorMessageNotEqual.SetVisible(false);
});