System.Web.UI.WebControls.MenuItemBinding.FormatString Property

Gets or sets the string that specifies the display format for the text of a menu item to which the System.Web.UI.WebControls.MenuItemBinding object is applied.

Syntax

[System.ComponentModel.DefaultValue("")]
[System.ComponentModel.Localizable(true)]
public string FormatString { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The MenuItemBinding.FormatString property is used to provide a custom format for a menu item's text. The format string can consist of a literal string, a placeholder, or both. The literal string is displayed verbatim, while the placeholder is replaced with the value that is bound to the menu item's text.

The placeholder is split into two parts, separated by a colon, in the form {A:Bxx}. For example, {0:F2} displays a fixed-point number with two decimal places.

Note:

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

Keeping to the standard formatting string syntax, the value before the colon (A in the general example) specifies the parameter index in a zero-based list of parameters. Because only one value can be displayed in each menu item, the parameter index can be set only to 0.

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

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 characters are 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.

The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see System.ComponentModel.LocalizableAttribute and ASP.NET Globalization and Localization.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0