Differences in. NET Data-bound controls

Source: Internet
Author: User

GridView Control

The GridView control displays data as a table and provides the ability to sort, page, scroll through data, and edit or delete individual records.

Feature: A single line of records, like a news list, with paging functionality.

DataList controls

The DataList control renders the data as a table through which you can use different layouts to display data records, such as rows or columns of data records. You can configure the DataList control to enable users to edit or delete records in a table. (The DataList control does not use data modification features of the data source control; You must provide this code yourself.) The DataList control differs from the Repeater control in that the DataList control explicitly places the item in the HTML table and the Repeater control does not.

Feature: A row can have multiple records, just like a list of pictures, and the paging function requires handwriting.

The Repeater control Repeater control renders 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 templates to create layouts for Repeater controls.

Features: free customization; The paging function requires handwriting.

ListView Control

This control can achieve the same effect as the GridView, or it can achieve the same effect as DataList (no wonder the name is ListView), which is more complicated to apply. The point is: LayoutTemplate must have a server-side control, runat= "Server", whose ID must be itemplaceholder (unless you change the itemplaceholderid of the ListView), note case, The content output in the ItemTemplate template is inserted into the itemplaceholder. But the ListView paging is not so complicated, drag a DataPager control into the LayoutTemplate template, and specify a good DataPager fields. But DataPager does not send the two parameters of startRowIndex and maximumrows to DataSource, which means that the paging is to take out all the records, just the display part, not an efficient paging. See: Declarative data Binding Tutorial-objectdatasource.

Features: Free customization, powerful, complex application, the paging function requires handwriting.

Detailed Class DetailsView controls

The DetailsView control renders a table-style record at a time and provides the ability to scroll through multiple records and insert, update, and delete records. DetailsView controls are typically used in master/detail scenarios where the selected records in the master control (such as the GridView control) determine the records that are displayed by the DetailsView control.

Features: One record, one row for a field, and a paging function.

FormView Control

The FormView control, like the DetailsView control, renders one record in the data source at a time and provides the ability to scroll through 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, while the FormView Control does not specify a predefined layout for displaying records. In effect, you will create a template that contains controls to display the individual fields in the record. The template contains the formatting, controls, and binding expressions used to set the form layout.

Features: A record, free customization, with paging function.

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.