Compartir a través de


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)

Syntax

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

Property Value

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

Exceptions

Exception Condition
InvalidOperationException

Both ErrorMessageResourceName and ErrorMessage are set.

-or-

Neither ErrorMessageResourceName nor ErrorMessage is set.

-or-

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

Remarks

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

Silverlight

Supported in: 5, 4, 3

Platforms

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