GridLookupViewModel.TextFormatString Property
Gets or sets the pattern used to format a selected item’s text for display in the editor’s edit box.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
Property Value
Type | Description |
---|---|
String | A string value that specifies the format pattern. |
Remarks
When an end-user selects items in the editor’s dropdown list, each selected item is represented in the editor’s edit box using a text value formatted based upon the TextFormatString property’s setting. If multiple item selection is allowed (the GridLookupProperties.SelectionMode is set to GridLookupSelectionMode.Multiple), texts of different selected items are joined in the edit box using a special separator defined by the GridLookupProperties.MultiTextSeparator property.
By default, the TextFormatString property is set to an empty string. In this case, a textual representation of a selected item is composed from values of all data columns (MVCxGridViewColumn descendants) contained in the editor’s GridLookupSettings.Columns collection, regardless of the column visibility defined. The order of column values corresponds to the order in which data columns are listed in the Columns collection. Column values are separated with a default separator represented by a semicolon and white space symbols.
You can use the TextFormatString property to provide a custom format for a selected item’s value displayed in the editor’s edit box. Set the property’s value by using indexed placeholders (such as “{0}”, “{1}”, etc.), which can be combined with fixed literals and can contain standard or custom format strings. Placeholder indexes correspond to positions of data columns in the GridLookupSettings.Columns collection. Command columns and band columns are not considered by placeholder indexes.
If incremental filtering is used (the GridLookupProperties.IncrementalFilteringMode property is not set to IncrementalFilteringMode.None), the value typed by an end-user in the edit box is searched in the editor’s list, based upon the TextFormatString property’s defined format.