ASP. NET data controls: GridView, DataList, Repeater, DetailsView, and FormView.
Summary of ASP. NET data controls:
1. The first three are used to present multiple records, and the last two are used to present single data details, that is, common record details.
2. The layout of the GridView and DetailsView controls is fixed, and the layout function of custom data display is limited, which is generally suitable for simple data presentation. 3. DataList, Repeater, and FormView data controls have strong custom Layout capabilities. If data presentation requires a complicated layout scheme, these three controls are preferred.
4. The GridView, DetailsView, and FormView controls are newly added to. net 2.0, with built-in paging, sorting, and other functions. Their improvements are incomparable to the controls provided by 1.1.
5. DataList and Repeater are controls provided in version 1.1. The built-in functions are weak. You need to implement paging, sorting, data events, and other functions on your own.
Interestingly, on the current Asp.net platform, if the DetailsView corresponds to the FormView when a single column of data is displayed, the DetailsView layout is fixed and the FormView custom layout is fixed, when presenting multiple columns of data, only the GridView is responsible for the layout of fixed data. In terms of function, there is no corresponding control that matches the GridView.
The data function provided by DataList is too weak compared with that provided by the GridView. dataList requires programmers to write their own code to implement the desired functions, compared to the data presentation task of GridView, which can be carried out without programming.
The GridView control of ASP. Net data control:
The GridView control displays data in the form of a table, and provides the function of sorting, paging, reading data, and editing or deleting a single record.
Note: The GridView control is a successor control of the DataGrid control provided in earlier versions of ASP. NET. In addition to adding new features that utilize the data source control function, the GridView control also implements some improvements, for example, define the functions of multiple primary key fields, use the bound fields and templates to improve user interface customization, and use the new model to process or cancel events.
The DetailsView control of ASP. Net data control:
The DetailsView control displays a record in the form of a table at a time, and provides the ability to read multiple records and insert, update, and delete records. The DetailsView control is usually used in the master/details scheme. In this scheme, the selected records in the master control, such as the GridView control, determine the records displayed by the DetailsView control.
FormView control of ASP. NET data control:
The FormView control is similar to the DetailsView control. It presents one record in the data source at a time and provides the ability to read multiple records and insert, update, and delete records. However, the difference between the FormView control and the DetailsView control is that the DetailsView control uses a table-based layout in which each field of the data record is displayed as a row in the control. The FormView control does not specify the predefined layout for displaying records. In fact, you will create a template containing the control to display each field in the record. This template contains the format, controls, and binding expressions used to set the form layout.
Repeater control of ASP. NET data control:
The Repeater control displays a read-only list using a set of records returned by the data source. Similar to the FormView control, the Repeater control does not specify a built-in layout. You can use a template to create a Repeater control layout.
DataList control of ASP. NET data control:
The DataList control presents data in the form of a table. With this control, you can use different la s to display data records, such as arranging data records into columns or rows. You can configure the DataList control so that you can edit or delete records in the table. The DataList control does not use the data modification function of the data source control. You must provide this code by yourself .)
The basic information about the five Data Controls of ASP. NET is introduced here. I hope to introduce you to the basic information about the data controls of ASP. NET.
- Step 11 of ASP. NET Programming Model Page Lifecycle
- Interface Design Standards for ASP. NET Programming specifications
- Brief Analysis on naming rules of ASP. NET Programming specifications
- Analysis of ASP. NET programming standards and Their encoding specifications
- Test Specification Analysis of ASP. NET Programming specifications