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.