Difference between boundfield and templatefield in gridview

Source: Internet
Author: User


. Net learning Diary
16:29:30 read 299 comments 0 font size: large, medium, and small subscriptions

Boundfield can only implement one fixed display format, while templatefield can implement any display format you want to achieve. Therefore, templatefield is more flexible, but sometimes it is wise to use a cool tool.

Bytes -----------------------------------------------------------------------------------------------------------

Boundfield: simple data binding, convenient and fast

Templatefield: In addition to binding data, you can also set controls and complex styles.

Bytes -----------------------------------------------------------------------------------

Boundfield is used for simple and fixed data display.

Templatefield is flexible and can be used in combination for displaying complex data.

Bytes --------------------------------------------------------------------------------------------------

Boundfield is generally used for the direct setting of fields.

Templatefield is more fancy. You can add dropdown to it.

----------------------------------------------------------------------------------

Boundfield column: bind data directly

Templatefield column: It can be placed into a control or other display control.


Then control the display information of the templatefield column in The create or bound event.

----------------------------------------------------------------------------------

Boundfield: the binding column. As the name implies, it is the column that needs to be bound to the data source for display. It can be displayed only when a field is bound to the datafield attribute of boundfield.


Templatefield: Template column. As the name suggests, a template is provided for the display of this column. You can define the template and add something you want, for example, adding controls to it, very flexible ..


Therefore, you can use boundfield to display data. If you want to add special requirements to the column, you can use templatefield.

Bytes ----------------------------------------------------------------------------------------------------------------------------

Templatefield can complete all boundfield functions. It is often used in practical applications.

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.