Transformation from traditional ASP to ASP. NET: Understanding controls

Source: Internet
Author: User
Tags what is asp

DataGrid, DataList, and Repeater are the three most commonly used controls in ASP. NET. The following describes the transformation from traditional ASP to ASP. NET: What are the defects of traditional ASP and how ASP. NET solves these problems based on the considerations.

Traditional ASP Problems

Since the emergence of simple and script-based Web programming technology such as Microsoft Active Server Pages (ASP), Web development has experienced great development. A lot of tedious and repetitive coding work in traditional ASP does not exist in Microsoft ASP. NET. For example, as all traditional ASP developers once knew, displaying data on traditional ASP Web pages requires the following pseudo code:

 
 
  1. Create connection to the database  
  2. Populate an ADO Recordset with a SQL query  
  3.  
  4. Display any header HTML needed  
  5. For Each Record in the Recordset  
  6.    Print out the Recordset field(s) and associated HTML  
  7.    Move to the next record  
  8. Next 
  9. Display any footer HTML needed  

For example

<Table>

The record set content is displayed, and developers have

<Table>

Tags generate HTML tags, and then traverse each record in the record set cyclically.

<Tr>

Tag, and many

<Td>

The value of the tag and the record set field to be displayed. Finally, after the loop, the developer needs to generate the end

<Table>

Mark.

This method, which is required by traditional ASP, has a major drawback: it closely integrates HTML content with the source code of ASP Web pages. Because code and HTML content are not separated, it is difficult to modify HTML content, especially for graphic artists or Web designers who do not understand programming technology. Besides, because code is required to retrieve database results and generate content, this integration of code and HTML content requires a large amount of code.

Traditional ASP to ASP. NET: Control Introduction

Fortunately, ASP. NET provides three controls, making it easier to display data on ASP. NET Web pages than traditional ASP requires for iterative methods. These three controls are DataGrid, DataList, and Repeater, which I will call a Data Web control later. Maybe, if you have developed an ASP. NET Web page, you will have at least some experience with one of the three controls. Generally, developers start learning the DataGrid because it is easy to use and has the ability to allow data sorting, paging, and editing. However, when the data is displayed on the ASP. NET Web page, the DataGrid is not always the best choice for the control.

In the following section, we will study the unique features of each control in these data Web controls. These features give each data Web control many advantages and disadvantages. Because every data Web control has some disadvantages, there is no "perfect" control that can be used for any job. When deciding which control to use, you must weigh the advantages and disadvantages of each of the three data Web controls, and then decide which control is the most suitable.

To assist in the comparison, when studying every data Web control, we will focus on these three metrics: availability from the perspective of Web visitors), development time and performance. First, let's take a quick look at the similarity between the three data Web controls. Next we will study the DataGrid in depth, study DataList, and finally view Repeater. For each control, we will study the functions of these controls and discuss how their feature set affects these metrics.

The above briefly introduces the transformation from traditional ASP to ASP. NET.

  1. How to use ASP. NET to debug APIs
  2. Five methods for generating HTML static pages using ASP. NET templates
  3. How to Use the ASP. NET Login Control
  4. What is ASP. net mvc and its advantages
  5. Differences between ASP. net mvc and WebForm

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.