ButtonColumn.DataTextFormatString Property

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

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
virtual property String^ DataTextFormatString {
	String^ get ();
	void set (String^ value);
}
/** @property */
public String get_DataTextFormatString ()

/** @property */
public void set_DataTextFormatString (String value)

public function get DataTextFormatString () : String

public function set DataTextFormatString (value : String)

Not applicable.

Property Value

The string that specifies the display format for the caption in each button. The default is an empty string ("").

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

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

NoteNote:

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.

NoteNote:

This value can be set only 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

Displays numeric values in

C

Currency format.

D

Decimal format.

E

Scientific (exponential) format.

F

Fixed format.

G

General format.

N

Number format.

X

Hexadecimal format.

NoteNote:

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.

The value of this property is stored in view state.

For more information on formatting strings, see Formatting Overview.

The following code example demonstrates how to use the DataTextFormatString property to display the caption of each button in the ButtonColumn object in currency format.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: