. Net data table display controls

Source: Internet
Author: User

1. GridView Control

The GridView control is used to display data in a table. By using the GridView control, you can display, edit, delete, sort, and read table data in a variety of different data sources (including databases, XML files, and public data business objects.

Displaying table data is a periodic task in software development. ASP. NET provides many tools to display table data in a grid, such as the GridView control. By using the GridView control, you can display, edit, and delete data in a variety of different data sources, such as databases, XML files, and business objects that expose data.

You can use the GridView to complete the following operations:

1. automatically bind and display data through the data source control.

2. Select, sort, pagination, edit, and delete data using the data source control.

3. You can also customize the appearance and behavior of the GridView control in the following ways:

A) Specify custom columns and styles.

B) use the template to create a Custom User Interface (UI) element to specify the custom columns and styles.

C) add your code to the GridView control by processing events.

Applicable scenarios

The GridView control is generally used to display two-dimensional relational data of rules in the form of tables. For example, it is used to display the list of all users under the site.

2. DataList Control

The DataList Web Server Control displays information about database rows in a custom format. The format of the displayed data is defined in the created template. You can create templates for items, alternate items, selected items, and edit items. The header, footer, and separator templates are also used to customize the overall appearance of DataList. By adding a Web server control to a template, you can connect the list items to the Code, which allows you to switch between display, selection, and editing modes.

Different from the GridView, DataList must use a custom template to display data items. Compared with the GridView, DataList does not support sorting and paging.

Applicable scenarios

DataList is generally used to display data in the "single column, multiple rows" relationship. For example, it is used to display the product list. Each ListItem displays the information of a product. You can define your own format for ListItem.

3. Repeater control

The Repeater Web Server Control is a container control that allows you to create a custom list from any available data on the page. The Repeater control does not have a built-in rendering function, which means that you must provide a layout for the Repeater control by creating a template. When this page is running, the Repeater control uses records from the data source in sequence and presents an item for each record.

The Repeater control is the shortest compared with the preceding two controls. Repeater is generally used for read-only data and does not have the edit, sort, and paging functions for the list displayed by data.

Applicable scenarios

The function is very thin. It uses a set of records returned by the data source to present a read-only list.

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.