Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ErrorMessage Property

ValidationAttribute.ErrorMessage Property

Gets or sets an error message to associate with a validation control if validation fails.

Namespace:  System.ComponentModel.DataAnnotations
Assemblies:   System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)
  System.ComponentModel.Annotations (in System.ComponentModel.Annotations.dll)

public string ErrorMessage { get; set; }

Property Value

Type: System.String
The error message that is associated with the validation control.

This property is the error message that you associate with the validation control. It is used for non-localized error messages.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5 SP1

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft