ASP. NET-Server Control instance tutorial

Source: Internet
Author: User
Tags classic asp

. Net Is Object-Oriented Programming, and all its elements exist in the form of controls. Let's take a look at the ASP. NET-Server Control instance tutorial.

. Net Is Object-Oriented Programming, and all its elements exist in the form of controls. Let's take a look at the ASP. NET-Server Control instance tutorial.

The server control mark is a server that understands.


Limited to traditional ASP
The following list copies the previous chapter:

The above code illustrates the limitation. The classic ASP: the code block must appear in the output you want.

Unlike the classic ASP, it is impossible to execute code independently from the HTML itself. This makes the webpage difficult to read and maintain.




ASP. NET-server controls
ASP. NET solves the "pasta code" problem, as described above in the server control.

The server control mark is a server that understands.

There are three server controls:

HTML Server Control-traditional HTML labels
Web Server Control-New a sp. NET tag
Verify the Server Control-for input verification



ASP. NET-h tml Server Control
The HTML tag of the HTML Server Control is understood by the server.

HTML elements are considered as text by default in ASP. NET files. To make these elements programmable, runat = "server" is added"

The HTML element of the attribute. This attribute indicates

The content should be considered as a server control. This attribute adds server identification control. The reference ID can be used to control the running status of the server.

Note: All HTML server controls must be in the runat = "server" attribute of a <form> flag. The runat = "server" attribute indicates that,

Form should be processed on the server. The report also states that the attached control can be performed through the server script.

In the following example, we declare that the HtmlAnchor server is controlled. Aspx file. Then,

We have manipulated the HtmlAnchor attribute of HREF to control it in an event handler (an event handler is a subprogram's Execution Code for a specific event)

. The Page_Load event is an event. Many ASP. NET understandings:

 

<script runat="server">Sub Page_Loadlink1.HRef=http://www.111cn.cnEnd Sub</script>
<form runat="server"><a id="link1" runat="server">Visit 111cn.cn!</a></form>
</body>

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.