EditContext Class (Microsoft.AspNetCore.Components.Forms) (original) (raw)

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.

Constructors

EditContext(Object) Constructs an instance of EditContext.

Properties

Model Gets the model object for this EditContext.
Properties Gets a collection of arbitrary properties associated with this instance.
ShouldUseFieldIdentifiers Gets whether field identifiers should be generated for elements.

Methods

Field(String) Supplies a FieldIdentifier corresponding to a specified field name on this EditContext's Model.
GetValidationMessages() Gets the current validation messages across all fields. This method does not perform validation itself. It only returns messages determined by previous validation actions.
GetValidationMessages(Expression<Func>) Gets the current validation messages for the specified field. This method does not perform validation itself. It only returns messages determined by previous validation actions.
GetValidationMessages(FieldIdentifier) Gets the current validation messages for the specified field. This method does not perform validation itself. It only returns messages determined by previous validation actions.
IsModified() Determines whether any of the fields in this EditContext have been modified.
IsModified(Expression<Func>) Determines whether the specified fields in this EditContext has been modified.
IsModified(FieldIdentifier) Determines whether the specified fields in this EditContext has been modified.
IsValid(Expression<Func>) Determines whether the specified fields in this EditContext has no associated validation messages.
IsValid(FieldIdentifier) Determines whether the specified fields in this EditContext has no associated validation messages.
MarkAsUnmodified() Clears all modification flags within this EditContext.
MarkAsUnmodified(FieldIdentifier) Clears any modification flag that may be tracked for the specified field.
NotifyFieldChanged(FieldIdentifier) Signals that the value for the specified field has changed.
NotifyValidationStateChanged() Signals that some aspect of validation state has changed.
Validate() Validates this EditContext.

Events

OnFieldChanged An event that is raised when a field value changes.
OnValidationRequested An event that is raised when validation is requested.
OnValidationStateChanged An event that is raised when validation state has changed.

Extension Methods

AddDataAnnotationsValidation(EditContext) Obsolete. Adds DataAnnotations validation support to the EditContext.
EnableDataAnnotationsValidation(EditContext, IServiceProvider) Enables DataAnnotations validation support for the EditContext.
EnableDataAnnotationsValidation(EditContext) Obsolete. Enables DataAnnotations validation support for the EditContext.
FieldCssClass(EditContext, FieldIdentifier) Gets a string that indicates the status of the specified field as a CSS class.
FieldCssClass(EditContext, Expression<Func>) Gets a string that indicates the status of the specified field as a CSS class. This will include some combination of "modified", "valid", or "invalid", depending on the status of the field.
SetFieldCssClassProvider(EditContext, FieldCssClassProvider) Associates the supplied FieldCssClassProvider with the supplied EditContext. This customizes the field CSS class names used within the EditContext.