asp.net dataformatstring formatting gridview_ practical skills

Source: Internet
Author: User
In. NET, the MSDN has been checked for half a day, and it is found that using dataformatstring can implement this functionality, but how the setting does not work, and finally found that, because 2.0 for security reasons, but also to set HTMLEncode = False, can make dataformatstring effective.

Leave a mark, the next time you use, you don't have to waste more than n time. Also, dataformatstring = "{0:f}", which is the default format, displays two decimal places, and dataformatstring = "{0:FN}" if you need to display a number of decimal places for other values.
Copy Code code as follows:

Dataformatstring= ' {0: format string} '

{0} in dataformatstring represents the data itself, while the format string following the colon represents the format in which the data is expected to be displayed;
Related Article

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.