Precautions for using the gridview

Source: Internet
Author: User

Use of the gridview:
1. Unable to bind control records. When the gridview binds the dataset, if the dataset is empty. The gridview does not display the table header. It is very depressing ......

2. The time format of the binding column seems to be supported by an error.
For example, I have a time field datetime = "10:01:00"
When my gridview uses a bound column, the format cannot be set.
<Asp: boundfield datafield = "datetime" dataformatstring = "{0: hh: mm}"/>
In this way, the column still displays: 10:01:00

If I use the template column, it is successful.
<Asp: templatefield>
<Itemtemplate>
<Asp: Label id = "label1" runat = "server" text = '<% # BIND ("datetime", "{0: hh: mm }") %> '> </ASP: Label>
</Itemtemplate>
</ASP: templatefield>
In this way, in the column, it displays: 10: 01

The usage of bind and the use of dataformatstring of the gridview are as follows.

Change datafromatstring to dataformatstring = "{0: yyyy-mm-dd} to bind the display time.

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.