| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BoundColumn.DataFormatString PropertySystem.Web.UI.WebControls Namespace BoundColumn Class Sets or retrieves the string that specifies the display format of data for the column. Syntax
Property Value
The property is read/write with no default value. RemarksUse the DataFormatString property to specify the display format for data in the column. The data format string consists of two parts, separated by a colon and wrapped in braces, in the form { A:Bxx }
A specifies the parameter index in a zero-based list of parameters. This value can only be "0" since there is only one value in each cell. B specifies the format to display the value according to the following table:
The formatting character is not case sensitive except for "X", which displays the hexidecimal characters in the case specified. xx specifies the number of significant digits or decimal places to display the value. For example, the formatting string {0:D2} would format the cell to display a number with two decimal places.
For more information on formatting strings, see Formatting Base Types. ExampleThe following example demonstrates how to use the DataFormatString property to specify currency format for the column that displays prices in a DataGrid control. <asp:boundcolumn headertext = "Price"
datafield = "Price"
dataformatstring = "{0:c}"
itemstyle-horizontalalign = "right" />
The following table contains examples of formatting strings and the results. The example assumes standard English settings.
See AlsoBoundColumn Members Adding Bound Columns to a DataGrid Control |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme