EditContext.OnValidationRequested Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An event that is raised when validation is requested. Validator components subscribe to this event to perform validation.
public:
event EventHandler<Microsoft::AspNetCore::Components::Forms::ValidationRequestedEventArgs ^> ^ OnValidationRequested;
public event EventHandler<Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs>? OnValidationRequested;
public event EventHandler<Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs> OnValidationRequested;
member this.OnValidationRequested : EventHandler<Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs>
Public Event OnValidationRequested As EventHandler(Of ValidationRequestedEventArgs)
Public Custom Event OnValidationRequested As EventHandler(Of ValidationRequestedEventArgs)
Event Type
Remarks
Handlers run synchronously in subscription order. A validator that performs asynchronous work keeps its handler synchronous and registers an async validator via AddAsyncValidator(Func<CancellationToken,Task>), for example (sender, args) => args.AddAsyncValidator(token => ValidateAsyncCore(token)). ValidateAsync(CancellationToken) invokes every registered validator and awaits the resulting tasks; Validate() throws InvalidOperationException if a handler registers asynchronous work. Do not use an async void handler: its work is not awaited and is silently skipped.