Differences between ASP. net html server controls and web server controls

Source: Internet
Author: User

1. html Server Control: it is actually a control composed of the HTML control plus runat = "server. the differences between them are that HTML controls run on the client, while HTML server controls run on the server. All HTML server controls inherit the htmlcontrol class, which can be divided into three types: htmlinputcontrol, htmlcontainercontrol, and htmlimage ).
2. Web Server Control: Also known as Asp.net Server Control, which can display more advanced functions than HTML. It is a basic element of web form programming and also exclusive to Asp.net. It generates one or more HTML controls based on the client, rather than directly describing HTML elements. For example, <asp: button id = "button2" runat = "server" text = "button"/>.
 
3. What are the differences between HTML server controls?
1) The Asp.net Server Control provides a more unified programming interface. For example, each Asp.net Server Control has the text attribute.
2) Hide the differences between the client, so that the programmer can focus more on the business, instead of considering whether the client browser is IE, Firefox, or a mobile device.
3) The Asp.net server control can be saved to viewstate, so that the page can be saved during the process of uploading the page from the client back to the server or downloading it from the server to the client.
4) different event processing models: HTML tagging and HTML Server Control event processing are on the client page, while Asp.net server controls are on the server.
For example:
<Input id = "botton" type = "button" value = "button" runat = "server"/>
It is an HTML server control. At this time, we click this button and the page will not be uploaded back to the server, because we did not define a mouse click event for it. We add an onserverclick event for the HTML Server Control:
<Input id = "botton" type = "button" value = "button" runat = "server" onserverclick = "test"/>

Click this button to send the page back to the server and run the test (objecdt sender, eventargs e) method.

The following code:
<Asp: button id = "button" runat = "server" text = "button"/>
Is an ASP. NET Server Control, and we do not define a click for it. However, when we click it, the page will be sent back to the server.
It can be seen that HTML tagging and HTML server control events are triggered by pages, while Asp.net server controls are sent back to the server by pages for processing.

Transferred from [FLORA]

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.