Back to Devexpress

ASPxAutoCompleteBoxBase.TextFormatString Property

aspnet-devexpress-dot-web-dot-aspxautocompleteboxbase-f321b7e3.md

latest4.7 KB
Original Source

ASPxAutoCompleteBoxBase.TextFormatString Property

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

Declaration

csharp
[DefaultValue("")]
public virtual string TextFormatString { get; set; }
vb
<DefaultValue("")>
Public Overridable Property TextFormatString As String

Property Value

TypeDefaultDescription
StringString.Empty

A format pattern.

|

Remarks

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.

aspx
<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.

|

aspx
<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:

See Also

TextFormatString

List Editors in Multi-Column Mode

Columns

Code central example E3591: How to use the TextFormatString property for multi-column ASPxComboBox

Combo Box

Formatting Types in the .NET Framework

ASPxAutoCompleteBoxBase Class

ASPxAutoCompleteBoxBase Members

DevExpress.Web Namespace