[Repost] ASP.NET Lecture (2) -asp.net control

xiaoxiao2021-03-06  18

2.1 ASP.NET Getting Started

Usually talk about a discipline, we always say that it is very simple to get started, ASP.NET is also. ASP.NET proposes a concept that is considered a web page, and it is also a form, so learned from object-oriented VB VC BC Dephi friends, it is simple to learn.

An ASP.NET page suffers are ".aspx", so IIS will also take Default.aspx as your default home when you install the ASP.NET, network management friends must pay attention.

ASP.NET is compiled after the day, just compiled during the first runtime, so after the running speed is faster than the ASP.

2.2 Write the first ASP.NET program

Excited? Soon I started to write the first program. Generally, I want to be Hello World! Let's take a look, then we come. Before this, I want to say, ASP.NET's program can be written in anything, even Windows notepad, and Christ Mountain is also confused. Do you want to write in v interdev .net, it is true that there is no meaning. Handwritten.

<% @ Page language = "vb"%> "What kind of language you use is written. Net, if it is VB, this line can not write.

<% Reponse.write ("Hello World")%>

Name myfirstasp_net.aspx to come to us, really, Hello World!

Note that the response.write statement, our original written to response.write "Hello World!" Is also correct, but in .NET, you must use "(" and ")".

2.3 HTML control

The first set of controls in the ASP.NET framework is called HTML controls. These controls are located in the System.Web.ui.htmlControls namespace, which is directly or indirect from the HTMLControl base class. Figure 1 illustrates the class hierarchy of the HTML control.

Figure 1. ASP HTML control

Almost all tags containing the runat = "server" attribute will generate an HTML control. For example, the following HTML can create an instance of HTMLInputText control called "TextBox1":

The HTML control and the corresponding HTML tag are listed in the table below.

Control marker corresponding HtmlAnchor HtmlButton