Back to Devexpress

ASPxClientGlobalEvents.ValidationCompleted Event

aspnet-js-aspxclientglobalevents-55b607ba.md

latest4.3 KB
Original Source

ASPxClientGlobalEvents.ValidationCompleted Event

Occurs on the client side after the validation initiated for a DevExpress web control (or a group of DevExpress web controls) has been completed.

Declaration

ts
ValidationCompleted: ASPxClientEvent<ASPxClientValidationCompletedEventHandler<ASPxClientGlobalEvents>>

Event Data

The ValidationCompleted event's data class is ASPxClientValidationCompletedEventArgs. The following properties provide information specific to this event:

PropertyDescription
containerGets a container object that holds the validated control(s).
firstInvalidControlGets the first control (either visible or invisible) that hasn’t passed the validation applied.
firstVisibleInvalidControlGets the first visible control that hasn’t passed the validation applied.
invisibleControlsValidatedGets a value that indicates whether validation has been applied to both visible and invisible controls.
isValidGets a value specifying whether the validation has been completed successfully.
validationGroupGets the name of the validation group name to which validation has been applied.

Remarks

Each time validation 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 within different tab pages of the ASPxPageControl and need to move input focus to an invalid editor within a non-active tab page.

Example

csharp
<script runat="server">
     protected void ASPxGlobalEvents1_ValidationCompleted(object sender, 
     DevExpress.Web.ValidationCompletedEventArgs e) {
     lErrorMessageNotEqual.ClientVisible = !tbPassword.Value.Equals(tbConfirmedPassword.Value);
     }
</script>
...
<dxge:ASPxGlobalEvents id="ASPxGlobalEvents1" runat="server" 
OnValidationCompleted="ASPxGlobalEvents1_ValidationCompleted">
    <ClientSideEvents ValidationCompleted="OnValidationCompleted" />
</dxge:ASPxGlobalEvents>
...
javascript
function OnValidationCompleted(s, e) {
                if(e.isValid && Password.GetValue() != ConfirmedPassword.GetValue()) {
                    ConfirmedPassword.SetFocus();
                    ErrorMessageNotEqual.SetVisible(true);
                    e.isValid = false;
                } else
                    ErrorMessageNotEqual.SetVisible(false);
            }

See Also

ASPxClientGlobalEvents Class

ASPxClientGlobalEvents Members