Asp. NET Primer

Source: Internet
Author: User

Introduction to 2.1 asp.net

Usually talk about a subject, we always say, it is very easy to get started, asp.net is also. ASP.net put forward a concept, is that the Web page, is also a form, so, learning Object-oriented programming vb VC BC dephi Friends, learn it is much simpler.

A asp.net page suffix name is ". aspx", so, IIS after you install ASP.net, also will default.aspx as your default home, network management friend must pay attention to.

ASP.net is compiled and run, but compiled at the first run, so it runs faster than the ASP.

2.2 Write your own first ASP.net program

Are you excited? Soon began to write the first program, general learning any language should be Hello world!, then we also come.

Before this write to say, ASP.net's program can write anything, even Windows Notepad, Monte Cristo was also very puzzled, or to use V InterDev. NET to write Ah, it turns out that the thing is not handwriting easy to use.

<%@ Page language= "vb"%> "explain the language you use to write. NET, if it is VB, this line can not write.

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

Named Myfirstasp_net.aspx come we run it, sure enough, Hello world!

Note that the Response.Write statement we originally wrote Response.Write "Hello world!" is also true, but in. NET, you must use "(and").

2.3 HTML Control

The first set of controls in the ASP.net framework is called an HTML control. These controls are located in the System.Web.UI.HtmlControls namespace and derive directly or indirectly from the HTMLControl base class. Figure 1 illustrates the class hierarchy of HTML controls.

Figure 1. asp+ HTML Control

Almost any markup that contains the runat= "server" attribute generates an HTML control for it. For example, the following HTML can create an instance of a HtmlInputText control named "TextBox1":

<input type="text" runat="server" id="textBox1" value="some text">

The HTML controls and corresponding HTML tags are listed in the following table.

Control The corresponding tag
HtmlAnchor <a>
HtmlButton <button>
HtmlSelect <select>
HtmlTextArea <textarea>
HtmlInputButton <input type= "button" >
HtmlInputCheckBox <input type= "Check" >
HtmlInputRadioButton <input type= "Radio" >
HtmlInputText <input type= "Text" > and <input type= "password" >
HtmlInputHidden <input type= "hidden" >
HtmlInputImage <input type= "image" >
HtmlInputFile <input type= "File" >
HtmlForm <form>
HtmlImage
HtmlTable <table>
HtmlTableRow <tr>
HtmlTableCell <td>
HtmlGenericControl Any other markup that does not have a corresponding control, such as <span>, <div>, etc.

For existing ASP programs, if porting to ASP.net, HTML controls will undoubtedly play the most important role.

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.