This documentation is archived and is not being maintained.

ValidationAttribute.ErrorMessageResourceType Property

Gets or sets the resource type to use for error message lookup if a validation fails.

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public Type ErrorMessageResourceType { get; set; }

Property Value

Type: System.Type
The type of error message associated with a validation control.


If you try to set an error message or ErrorMessageResourceType multiple times.


If the ErrorMessageResourceType is null or an empty string.

This property specifies the type of error message that is associated with a validation control and it is used for error message lookups. You use this property to identify the error message as defined in a resource error message file.

You can provide a resource error message file that can be localized by using the ErrorMessageResourceName property and specify the error message in the resource file by using the ErrorMessageResourceType property.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5 SP1