DataAnnotationsModelValidator Class

Definition

Provides a model validator.

public class DataAnnotationsModelValidator : System.Web.Mvc.ModelValidator
type DataAnnotationsModelValidator = class
    inherit ModelValidator
Public Class DataAnnotationsModelValidator
Inherits ModelValidator
Inheritance
DataAnnotationsModelValidator
Derived

Constructors

Name Description
DataAnnotationsModelValidator(ModelMetadata, ControllerContext, ValidationAttribute)

Initializes a new instance of the DataAnnotationsModelValidator class.

Properties

Name Description
Attribute

Gets the validation attribute for the model validator.

ControllerContext

Gets the controller context.

(Inherited from ModelValidator)
ErrorMessage

Gets the error message for the validation failure.

IsRequired

Gets a value that indicates whether model validation is required.

Metadata

Gets the metadata for the model validator.

(Inherited from ModelValidator)

Methods

Name Description
GetClientValidationRules()

Retrieves a collection of client validation rules.

Validate(Object)

Returns a list of validation error messages for the model.

Applies to