Tuesday, June 12, 2012

DataFormatString in GridView

Data Formatting Expression
Applied to Types
Description
Price: {0:C}
numeric/decimal
“Price:” is shown, followed by the number formatted as currency.
{0:D4}
integer
Shows an integer in a zero-filled 4-char-long string format.
{0:N2}%
numeric
Accuracy is set to 2 digits after decimal point. Shown with a percentage sign.
{0:000.0}
numeric/decimal
Show 1 digit after decimal point. Zeroes are filled in if the number is less than 100.
{0:D}
date/datetime
Standard DateTime format(e.g. Saturday, November 08, 2008”).
{0:d}
date/datetime
Short DateTime string like 11/06/08.
{0:yy-MM-dd}
date/datetime
08-11-08.

No comments:

Post a Comment