ASP. NET data binding control and asp.net Control

Source: Internet
Author: User

ASP. NET data binding control (convert) and asp.net Control

The three data binding controls ListBox, GridView, and Repeater are "efficient pagination". The ListBox and GridView have built-in pagination, but their efficiency is too low, and a small amount of data is acceptable, A large amount of data cannot be used at all. The Repeater control does not provide paging, but paging may also be used in actual development. We will also explain the paging 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: 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

Features: it provides adding, deleting, modifying, sorting, paging, and other functions. It also supports custom templates.

Missing: affects program performance and reduces 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 advantage: this control is a fully-developed control that allows you to freely display custom display methods.

Missing: 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: 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, paging, adding, deleting, and modifying. You can customize the template display.

Missing: 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: mostly used for multi-level linkage

Missing point: displays 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:

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.