First glance-HTML vs web forms

Source: Internet
Author: User

I. htmlAndWebDifferences between forms:

1. htmlPages are static, that is, they do not need to interact with the background. The content above is all written by you, but one of the biggest advantages is that the webpage is static, therefore, the loading speed of HTML pages is the fastest.

. Html is a static page that does not interact with the server. aspx can also be said to be static .. HTML can also implement dynamic functions when using Ajax, and is more flexible than. aspx, but it is more complicated to develop. A purely static page is a page that does not interact with the server or dynamically display or operate without data.

 

2,Data on web forms is mostly dynamically read from the database, so loading is slow. A web form is a combination of dynamic web pages, which can be divided into. aspx and the corresponding. CS files. The. aspx file can be used in the HTML markup language to implement the Web Front-end, And. CS is the server.CodeFor interaction. Web forms can be developed quickly using various server controls of.

If the content on the page is dynamic, read from the database or other files, it must be a web form, and the controls you use after creating the web form are also classified, for example, web server controls and HTML static controls affect the loading speed of your page.

 

Ii. htmLControls andWebWidget

Easy to use Web controls; convenient to use HTML controls, saving resources

 

1,ASP. NET provides many controls for Web application development, improving functions and security. Although Web controls and hunl controls have similar functions, their internal implementation mechanisms are completely different.

 

2. Asp.net Of Htmlcontrol Inherited from System. Web. UI. htmlcontrols Namespace, Webcontrol Inherit from System. Web. UI. webcontrols Namespace , Both classes are inherited from System. Web. UI. Control Of Windows Platform. Web The server control must be processed by the server. Html Controls are sent to the browser, which consumes server resources, Html Directly sent to the browser, which does not consume resources, but is saved in a stateless state.

 

3. html controls do not have any abstract capabilities. Each control corresponds to a tag. Web controls create high-level abstractions without any corresponding HTML mark. Because they are not directly mapped to HTML mark, therefore, Web controls can also be used for merging in appropriate occasions, for example, use a text box Control to replace multiple tags. Third-party controls provide convenience.

 

4. The biggest difference between HTML controls and Web controls is that they have different processing methods for events. For HTML form controls,When an event is triggered, the browser will handle it. However, for Web controls, events are only generated by the browser, but browsingThe client sends a message to the server telling the server to process the event.

 


5,Code

HtmLCode:

 
<Body> <p> <input id = "button1" type = "button" value = "button"/> </P> </body>


The HTML control is a common control and runs on the client. To make it executable on the server, runat = server must be added.


WebCode:

 
<P> <asp: button id = "button1" runat = "server" text = "button"/> </P>

The web control runs on the server side. It has a simple writing format and does not need to add runat statements. The essence of the web control is that the HTML control is reencapsulated in other ways.

 

Summary:HtmlIt is a static page, which can be used to write error interfaces and other simple interfaces that do not need to interact with the background;WebForms are used to interact with servers to achieve dynamic and complex functions.

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.