Use the ASP. NET gridview Control for column formatting time and dataformatstring

Source: Internet
Author: User

Symptom: When the gridview is bound to the date format, the date in the database is, while the gridview displays 000000. ,
Solution: If you want to remove this unused zero, you can add a sentence after the source code column of the binding time, as shown in the red section below. CopyCodeThe Code is as follows: <asp: boundfield datafield = "begindate" headertext = "Start Time"
Dataformatstring = "{0: d}" htmlencode = "false"
Headerstyle-horizontalalign = "center"
Itemstyle-horizontalalign = "center">

If there are any errors, you are welcome to criticize and correct them and make progress together.

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.