Some discussions about the circumstances in which the DataGrid, DataList, or repeater are used

Source: Internet
Author: User
Overview
Web development has undergone a lengthy process since it has scripted web programming technologies such as ASP. Through the use of Microsoft's ASP.net technology, the traditional ASP in a large number of tedious, repetitive programming work has become a history. For example, as most ASP programmers know, the process required to display database content in asp:
Establishing a database connection
Load an ADO DataSet with a SQL query
Display any HTML code that you want
Traversing records in a dataset
Output record field values and associated HTML
Move down one record
Cycle
Display the required HTML code
For example, to display the contents of a recordset in a table, we need to output a <table> tag, and then start the loop. In a loop, each output one record, you need to first output a <tr> tag and a number of <td> tags and </tr> tags. Finally, end with a </table> tag.
One of the main drawbacks of this approach used in traditional ASP is that the HTML code has to be entangled with the ASP source code. For page designers or graphic artists who may not understand programming, it is a disaster to change HTML content. In addition, the amount of code generated is amazing, because we need to make it visible not only from the database, but also from the data.
Fortunately, ASP. NET provides three data controls, making it easy to work with the complexity of the original ASP. These three controls belong to the data Web control, respectively, Datagrid,datalist and repeater. If you know anything about ASP.net database programming, you should at least have the experience of using one of these controls. In most cases, we start with learning to use a DataGrid because it's relatively complete (data display, paging, editing) and relatively simple. However, the DataGrid is not always the right choice.
This article discusses the characteristics of each data control differently from other data controls, as well as the advantages and disadvantages that it brings. Because each data control has its own flaws, there is no perfect choice in programming. You have to weigh the pros and cons of the three controls and decide which one is more appropriate for your program.
To help compare, when discussing each control, we focus on three features: availability (from the page visitor's perspective), development time, and performance. Let's first describe the commonalities of the three controls, and then discuss in depth the characteristics of the three controls, how each control is implemented, and how it reflects availability, development time, and performance.
[The common denominator of data controls (Controls)]
Before we discuss the respective characteristics of the three controls, it is necessary to look at the similarities between them. In general, the most obvious thing about the programming process is that the three controls are used to display data. Another common denominator is the need for a data-bound code to bind the data to the control. This process requires only two lines of code:

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.