Summary on the advantages and disadvantages of common ASP. NET data binding controls and common asp.net data

Source: Internet
Author: User

Summary on the advantages and disadvantages of common ASP. NET data binding controls and common asp.net data

The original intention of this article is to make an overview of common data binding controls in Asp.net, mainly analyzing the advantages and disadvantages of various data binding controls, in this way, you can select appropriate controls for Data Binding in actual development to improve development efficiency.

Most of these data binding controls have been encapsulated, and some basic friends can easily use them. Therefore, this article does not involve the use of specific controls, I only want to analyze their advantages and disadvantages, but in the next article, I will mainly talk about the "efficient paging" of the three data binding controls ListBox, GridView, and Repeater ", listBox and GridView have built-in paging, but the efficiency is too low. A small amount of data is acceptable, and a large amount of data cannot be used at all. The Repeater control does not provide paging, however, pages may also be used in actual development, so we will also tell you about the pages of Repeater.

Now, let's start with the topic. Let's start with the commonly used controls.

1. GridView Control

Main features:Supports deletion, modification, sorting, paging, appearance setting, and custom display data.

Missing points:It affects program performance and does not support insert operations.

This control can display, edit, and delete data in a variety of different data sources (such as databases, XML files, and collections) in the form of tables. The GridView control is very powerful. If needed, programmers can drag and drop through VS 2008 without writing any code and set properties from the property panel, you can also complete functions such as paging, sorting, and appearance settings. Although the functions are very complete, the program performance will be affected. It is best not to use this control too much on the page. Of course, if you need to display various data in a custom format, the GridView control also provides the template function for editing the format, but does not support data insertion.

Figure:

Ii. ListView Control

Main features:Supports adding, deleting, modifying, sorting, and paging. You can also customize templates.

Missing points:It affects program performance and Big Data paging efficiency.

The ListView control displays data in the template format written by the programmer. Similar to the DataList and Repeater controls, the ListView control applies to any data with duplicate structures. However, the ListView control provides data operations such as editing, inserting, and deleting data. It also provides the data sorting and paging functions, which can be directly set in VS 2008, you do not need to write code, which is very similar to the GridView control. It can be said that ListView has both open templates of the Repeater control and editing features of the GridView control. The ListView control is a new control added by ASP. NET 3.5. Its paging function must be implemented with the DataPager control. The ListView control is a new control added by ASP. NET 3.5. Its paging function must be implemented with the DataPager control. But for a large amount of data, the paging efficiency is very low, so in the next section, I will lead you to make an efficient paging. In general, ListView is currently the most complete and best-to-use data binding control.

3. Repeater control

Main advantages:This control is a fully-developed control that allows you to freely display custom display methods.

Missing points:Pagination, sorting, and editing are not supported. Only duplicate template content is provided.

The Repeater control is a data binding container control used to generate a list of sub-items. The display mode of these sub-items can be completely edited by the programmer. When the control is running on the page, the control displays the data format defined in the template based on the number of data rows in the data source. programmers can fully grasp the data display layout, such as div and ul. However, the disadvantage is that the control does not support functions such as sorting, paging, and editing. It only supports the duplicate template content function. However, in actual development, paging and other functions may be used, so in the next section, I will focus on the Repeater page.

Iv. DataList Control

Main advantages:Data can be displayed in custom formats and is flexible.

Missing points:Pagination, editing, and insertion are not supported.

This control can display fields of various data sources in a custom format, and its display data format is defined in the created template, you can create templates for items, alternate items, selected items, and edit items. The DataList control can also use the title, footer, and delimiter template to customize the overall appearance, and display multiple data rows in one row. Although the DataList control has great flexibility, it does not support data paging. programmers must compile their own methods to complete the paging function. It is only used for data display and cannot be edited, inserted, or deleted.

V. DetailsView Control

Main advantages:Displays a single piece of data in a table, supports sorting, insertion, deletion, modification, and paging.

Missing points:Sorting is not supported.

The DetailsView control displays only one record of the data source at a time in the form of a table tag, and each row under the table tag (tr tag) represents a field in the record. This control also supports data editing, insertion, and deletion, and allows you to easily set the paging function. However, the DetailsView control does not support data sorting.

6. FormView Control

Main advantages:Display single data, pagination, addition, deletion, and modification. You can customize the template display.

Missing points:Sorting is not supported.

The FormView control is similar to the DetailsView control. The FormView control only displays a single record in the data source. Different from the DetailsView control, the DetailsView control uses the table layout (table label). Each field in the record is displayed as a row. The FormView control is not used to display the preset layout of records. Programmers need to create subitem templates and compile various controls used to display fields in records and other HTML labels for layout. Like the DetailsView control, the FormView control can easily enable the paging function. If only one record is displayed, the FormView control is recommended because you can customize the data display format while developing it efficiently.

VII. DropDownList Control

Main advantages:Multi-level linkage

Missing points:Display a field as much as possible

The DropDownList control is generally used for multi-level interaction, such as provincial/municipal interaction. The key point here is to set the fields and values to be displayed for the DropDownList:

The binding result is as follows:

Here we have analyzed the advantages and disadvantages of the commonly used data binding controls in Asp.net. Only by deeply understanding the features of each control can we better adapt to the appropriate circumstances, use appropriate controls to facilitate program development. Of course, these controls may not be used in the actual development process. After Microsoft's encapsulation, too much additional information is generated, increasing the pressure on the server. However, I have summarized these things and hope they will help you. I hope you can give me more advice!

Related Article

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.