This documentation is archived and is not being maintained.

ValidationAttribute.ErrorMessageResourceName Property

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

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

public string ErrorMessageResourceName { get; set; }

Property Value

Type: System.String
The error message resource associated with a validation control.


If the ValidationAttribute is already in explicit mode or if you set the property multiple times.


If the value of error message is null.

This property specifies the error message resource that is associated with a validation control. You can use this property to specify a resource file that contains localizable error messages.

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