Differences between HTML controls, HTML server controls, and web server controls

Source: Internet
Author: User
The reason why Asp.net is Development The key to being convenient and quick is that it has a powerful control library, including Web server controls, Web user controls, Web custom controls, HTML server controls, and Html Controls. Here I will mainly talk about the differences between HTML controls, HTML server controls, and web server controls.

1. html controls: HTML Language Tags: these language tags exist on previous static pages and other webpages, and cannot be controlled on the server side. They can only be controlled on the client through JavaScript, VBScript, etc. Program Language. <Input type = "button" id = "BTN" value = "button"/>

2. html Server Control: in fact, it is the 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. For more information, see ASP. when the web page is executed, the system checks whether the annotation has the runat attribute. If the annotation is not set, the HTML annotation is regarded as a string and sent to the string stream for sending to the client. Browser It will be explained. If the HTML annotation has the set runat = "server" attribute, the page object will put the control into the controller, and the server code will be able to control it, after the control is executed, convert the execution result of the HTML Server Control to HTML annotation, the stream is sent to the client as a string for explanation. <input id = "button" type = "button" value = "button" runat = "server"/>

3. Web Server Control: Also known as Asp.net Server Control, 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"/> what is the difference between it and the HTML Server Control? For more information, see the following:
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 the Asp.net server control is on the server. For example:
<Input id = "button4" type = "button" value = "button" runat = "server"/> is an HTML Server Control. Click this button, the page will not be uploaded back to the server, because we have not defined a mouse click event for it.
<Input id = "button4" type = "button" value = "button" runat = "server" onserverclick = "test"/> we added an onserverclick event to the HTML Server Control, click this button to send the page back to the server and run the test (Object sender, eventargs e) method.
<Asp: button id = "button2" runat = "server" text = "button"/> is an Asp.net Server Control and we do not define a click for it. However, when we click, the page is also 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.

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.