ValidationContext.DisplayName Property

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

Gets or sets the name to display to users for the member to validate.

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

Syntax

'Declaration
Public Property DisplayName As String
public string DisplayName { get; set; }

Property Value

Type: System.String
The name of member to validate.

Exceptions

Exception Condition
ArgumentNullException

value is nulla null reference (Nothing in Visual Basic) or an empty string ("").

Remarks

The DisplayName property contains the name you show to users when responding to validation result. If the DisplayName property is not explicitly set, this property will retrieve the name from the associated DisplayAttribute. The Name property of the DisplayAttribute allows you to use localizable value for the name. If it cannot retrieve a name from the DisplayAttribute, it retrieves the value of the MemberName property. If MemberName is nulla null reference (Nothing in Visual Basic), which happens when validating the entity object, it returns the name of the entity type.

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.