Asp.net (C #)-Data Binding and formatting)

Source: Internet
Author: User
Asp.net (C #)-Data Binding and formatting (convert)

Example: <% # eval ("addtime", "{0: yyyy-mm-dd}") %>

Dataformatstring = "{0: Format String }"
1. Time Format: {0: yyyy-mm-dd}
2. Format numeric string input result
"{0: c}" 12345.6789 $12,345.68
"{0: c}"-12345.6789 ($12,345.68)
"{0: d}" 12345 12345
"{0: D8}" 12345 00012345
"{0: e}" 12345.6789 1234568e + 004
"{0: E10 }" 12345.6789 1.2345678900e + 004
"{0: F }" 12345.6789 12345.68
"{0: F0 }" 12345.6789 12346
"{0: g}" 12345.6789 12345.6789
"{0: G7}" 123456789 1.234568e8
"{0: n}" 12345.6789 12,345.68
"{0: N4}" 123456789 123,456,789.0000
"Total: {0: c}" 12345.6789 total: $12345.68
Dataformatstring = "{0: p}" // The percentage is automatically converted.
C
The value is displayed in currency format.

D
The value is displayed in decimal format.

E
The value is displayed in the scientific notation (INDEX) format.

F
The value is displayed in a fixed format.

G
The value is displayed in the regular format.

N
The value is displayed in numeric format.

X
The value is displayed in hexadecimal format.

Numeric string
Http://msdn2.microsoft.com/zh-cn/library/427bttx3 (vs.80). aspx
Date and Time Format String
Http://msdn2.microsoft.com/zh-cn/library/97x6twsz (vs.80). aspx
Enumerative Format String
Http://msdn2.microsoft.com/zh-cn/library/c3s1ez6e (vs.80). aspx
Custom Format String
Http://msdn2.microsoft.com/zh-cn/library/0asazeez (vs.80). aspx
Composite formatting
Http://msdn2.microsoft.com/zh-cn/library/txafckwd (vs.80). aspx

From: Baidu space, blue country http://hi.baidu.com/menghuan1985/item/c200ab549d3e719508be1746

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.