aspnet-devexpress-dot-web-dot-aspxautocompleteboxbase-f321b7e3.md
Specifies a pattern used to display the selected item’s text in multi-column mode.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
[DefaultValue("")]
public virtual string TextFormatString { get; set; }
<DefaultValue("")>
Public Overridable Property TextFormatString As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A format pattern.
|
In multi-column mode, the control’s edit box displays the selected row’s values one by one, separated by a semicolon.
The TextFormatString property allows you to change the selected item’s output text by a pattern that can contain literals and indexed placeholders such as “{0}”, “{1}”, and so on.
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server" DataSourceID="CustomersDataSource" ValueField="CustomerID"
TextFormatString="{0} is from {1}">
<Columns>
<dx:ListBoxColumn FieldName="ContactName" />
<dx:ListBoxColumn FieldName="Country" />
</Columns>
</dx:ASPxComboBox>
You can also use a standard or custom format string to customize the displayed text.
The following table contains the standard format specifiers:
|
Format specifier
|
Name
|
Description
| | --- | --- | --- | |
“C”
|
Currency
|
A currency value.
| |
“D”
|
Decimal
|
Integer digits with an optional negative sign.
| |
“E”
|
Exponential
|
Exponential notation.
| |
“F”
|
Fixed-point
|
Integral and decimal digits with an optional negative sign.
| |
“G”
|
General
|
The most compact of either fixed-point or exponential notation.
| |
“N”
|
Number
|
Integral or decimal digits, group separators, and a decimal separator with an optional negative sign.
| |
“P”
|
Percent
|
Number multiplied by 100 and displayed with a percent symbol.
|
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server" DataSourceID="SqlDataSource1" ValueField="ProductName"
TextFormatString="{0} costs {1:C}">
<Columns>
<dx:ListBoxColumn FieldName="ProductName" />
<dx:ListBoxColumn FieldName="UnitPrice" />
</Columns>
</dx:ASPxComboBox>
The following properties depend on the TextFormatString property:
ASPxAutoCompleteBoxBase.IncrementalFilteringMode - The control filters items according to the format specified in the TextFormatString property.
ASPxAutoCompleteBoxBase.ValueField - The control takes the formatted text as its value if the ValueField property is not specified.
See Also
List Editors in Multi-Column Mode
Code central example E3591: How to use the TextFormatString property for multi-column ASPxComboBox
Formatting Types in the .NET Framework