ValidationAttribute.ErrorMessageString Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the localized or non-localized error message.

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


Protected ReadOnly Property ErrorMessageString As String
protected string ErrorMessageString { get; }

Property Value

Type: System.String
The localized or non-localized error message.


Exception Condition

Both ErrorMessageResourceName and ErrorMessage are set.


Neither ErrorMessageResourceName nor ErrorMessage is set.


Either ErrorMessageResourceName or ErrorMessageResourceType is set, but the other is not.


If you set the ErrorMessageResourceName and ErrorMessageResourceType properties, the ErrorMessageString property contains the localized error message. If you set the ErrorMessage property, ErrorMessageString contains the non-localized error message.

Version Information


Supported in: 5, 4, 3


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.