This documentation is archived and is not being maintained.

ButtonColumn.DataTextFormatString Property

Gets or sets the string that specifies the display format for the caption in each command button.

[Visual Basic]
Public Overridable Property DataTextFormatString As String
[C#]
public virtual string DataTextFormatString {get; set;}
[C++]
public: __property virtual String* get_DataTextFormatString();
public: __property virtual void set_DataTextFormatString(String*);
[JScript]
public function get DataTextFormatString() : String;
public function set DataTextFormatString(String);

Property Value

The string that specifies the display format for the caption in each command button. The default value is String.Empty.

Remarks

Use the DataTextFormatString property to provide a custom display format for the caption of the command buttons in the column.

The data format string consists of two parts, separated by a colon, in the form { A: Bxx }. For example, the formatting string {0:F2} would format the cell to display a fixed point number with two decimal places.

Note   The entire string must be enclosed in braces to indicate that it is a format string and not a literal string. Any text outside the braces is displayed as literal text.

The value before the colon (A in the general example) specifies the parameter index in a zero-based list of parameters.

Note   This value can only be set to 0 because there is only one value in each cell.

The character after the colon (B in the general example) specifies the format to display the value in. The following table lists the common formats.

Format character Description
C Displays numeric values in currency format.
D Displays numeric values in decimal format.
E Displays numeric values in scientific (exponential) format.
F Displays numeric values in fixed format.
G Displays numeric values in general format.
N Displays numeric values in number format.
X Displays numeric values in hexadecimal format.
Note   The format character is not case-sensitive, except for X, which displays the hexadecimal characters in the case specified.

The value after the format character (xx in the general example) specifies the number of significant digits or decimal places to display.

For more information on formatting strings, see Formatting Overview.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

ButtonColumn Class | ButtonColumn Members | System.Web.UI.WebControls Namespace | Formatting Overview | String.Empty

Show: