| Visual Basic (Declaration) | |
|---|---|
Public Property DisplayText As String | |
| C# | |
|---|---|
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 ValueListItem.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 ValueListItem.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.
