Comparison between HTML controls and Web controls in Asp.net

Source: Internet
Author: User

In fact, this is not a new thing, and it is not hard to understand, but it is an old programmer's experience, for beginners, there must be some blank, why do HTML controls require Web controls? In fact, HTML controls are far less powerful than Web controls, but they are excessive. However, they also benefit from faster parsing than Web controls, because the web control must be returned by the server.
Web controls are concise and powerful;
HTML controls facilitate ASP porting, As long as runat = "srever" is added to the attribute, it can run on the server ....

HTML controls do not have any abstract capabilities. Each control corresponds to a tag.
Web controls create more advanced abstractions without any corresponding HTML tags (such as calendar and DataGrid ). Because they are not directly mapped to HTML tags, Web controls can also be used to merge tags in appropriate cases (for example, replacing multiple tags with a Textbox Control ). This abstraction opens the door to the use of a variety of control toolboxes provided by third parties.
Object Model
The HTML control provides an HTML-centered object model. Each control includes an attribute set that can be used to control the marked attributes. This attribute set uses a string name/value pair and is not of a strong type.
When using HTML controls, your programming method is very similar to using traditional ASP for programming. Therefore, the HTML control provides a shortcut for porting-you can add a runat = "server" attribute to convert a tag into a server control.
Web controls provide forms-based programming modes similar to Visual Basic. They also provide attribute sets, but their main goal is to provide an object model with rich formats, type security, and consistency. Each web control contains a set of standard attributes, such as forecolor, backcolor, and font.
This object model also provides a richer design experience in design tools such as visualstudionet.
Target Browser
The HTML control does not automatically detect the browser capabilities of the requested page, nor modify the HTML they provide. When using this set of controls, you are responsible for ensuring that your pages work on both advanced and low-level browsers.
Web controls can automatically adjust the results they generate to ensure that the output results are equally outstanding in both advanced and low-level browsers. Web controls can also provide different behaviors for different browsers, so as to give full play to the potential of browsers. For example, the validation control can also use the client script to create highly interactive pages for advanced browsers.
Control of generated HTML
The HTML control allows you to fully control the displayed content and the content sent to the client browser.
Web controls provide richer object models and the ability to adapt to multiple browsers. Therefore, they do not provide the same degree of control over the output results.
When developing an application, you can select the control groups based on their capabilities and requirements. You can also choose to mix the two controls on the same page. Using one type of control does not prevent you from using another type of control at the same time.

Click the Web Control to submit the page to the background.

The loading speed of HTML controls is faster than that of Web controls

You can use the HTML control when sending a message back.
Use Web controls whenever possible

 

 

Web controls run on the server, while HTML controls run on the client.
In layman's terms, the Web Control generates static code after running on the server side and passes it to the client browser. The HTML control is white, which is the original HTML tag, which is directly explained by the client browser.
To trigger the HTML control event, you can use the Javascript script to implement it. For details, refer to the relevant JavaScript documentation.

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.