Go: The difference between HTML and Web Forms

Source: Internet
Author: User
Tags html form

Summary:Html is a static page, can be used to write error interface and so on do not need to interact with the background, a simple interface,Web forms to interact with the server, to achieve dynamic, more complex functions.

One, The difference between Html and Web Forms:

1, the HTML page is static, that is, do not interact with the background, the above content is all you write good, but there is one of the biggest advantage is because the page is static, so the HTML page loading speed is the fastest.

. HTML is a static page, and the. aspx that does not interact with the server can also be said to be static. HTML can also be used for dynamic functions when applied to Ajax, and more flexible than. aspx, but relatively complex to develop. A purely static page is a page that does not interact with the server, shows and operates dynamically without data.

2, the Web forms above the data is dynamically read from the database, so load slower. A Web form is a combination of a dynamic Web page that is divided into. aspx and the corresponding. aspx file, which can be implemented in the HTML markup language of the Web page foreground, and. CS is the server code used to interact. Web Forms can be developed quickly using the various server controls of VS.

If the content on the page is dynamic, read from the database, or read from another file, it must be a Web form, and the controls you use after you create the Web form are categorized as well, such as Web server controls, HTML static controls, and so on, all of which affect how fast your page loads.

Two, HTMl controls and Web controls

Use Web controls for convenience; Use HTML controls, save resources

1,ASP. NET provides many controls for Web application development, with improved functionality and security, where Web controls and HUNL controls are similar in function. But their internal implementation mechanisms are completely different.

2, the HTMLControl Inheritance of ASP. system.web.ui.HtmlControls namespace,WebControl inherit at ease The System.Web.UI.WebControls namespace , which all two classes inherit from the System.web.UI.Control Windows platform. WEB server controls need to be processed by the server to be translated into HTML controls and then sent to the browser, consuming server resources,HTML sent directly to the browser, without consuming resources, but without state saving.

3, Html control does not have any abstraction ability. Each control is one by one corresponding to the marker. Web Controls create higher-level abstractions that do not have any corresponding Html markup. Because they are not directly mapped to Html tags, Web controls can also act as merging functions in the appropriate context, such as replacing multiple tags with a TextBox control. Provides convenience for using third-party controls.

4. The biggest difference between HTML controls and Web controls is that they differ in the way events are handled. For an HTML form control, when an event is raised, the browser processes it. For Web controls, however, the event is generated only by the browser, but the browser does not process it, and the client sends a message to the server telling the server to handle the event.

5. Code

HTML code:

1 <spanstyle= "FONT-SIZE:18PX;"><Body>  2   3     <P>  4         <inputID= "Button1"runat= "Server"type= "button"value= "button" /></P>  5   6 </Body>  7 </span>  

Web code:

 1  <  span  style  = "font-size:18px;"  ><  p           >  2  <  asp : Button  id  = "Button1"   Text  =" button " />  3  4  </ p  ></ span  >  

The Web control runs on the server side, the writing format is simple, and does not have the special runat statement, its essence still is the HTML control is just another way to reseal.

The above purely quoted, as a memory, left to review. Reference URL---http://blog.csdn.net/liutengteng130/article/details/9004660

Go: The difference between HTML and Web Forms

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.