DisplayText Property (ValueListItem)

Returns or sets a value that determines the text to be displayed instead of the cell data.
Public Property DisplayText As String
public string DisplayText {get; set;}

This property, in conjunction with the DataValue property, provides a way to store one value in the data source while displaying another. In this manner, the user can be presented with a list of states, for example, and if he or she selects "New York," the value "NY" could be stored in the data source. In this example, this property is set to "New York" while "NY" is the value of the DataValue property.

Values for this property do not have to be unique within the ValueListItems collection.

The Find method can be invoked to search for a valuelistitem by its display text.

Note: When the DisplayText property is not explicity set, a ValueListItem will display the string representation of its DataValue property.

Also note that it is possible for a ValueListItem to have its DisplayText property set while no value has been specified for the DataValue property; it this scenario, the DataValue will not be set, as it is possible that specifying a null DataValue for the item was intentional.


Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also