ASP. NET 2.0 new features

Source: Internet
Author: User


From quickstart:
Simplified Code Behind Model New in 2.0ASP.NET 2.0 introduces an improved runtime for code-behind pages that simplifies the connections between the page and code. in this new code-behind model, the page is declared as a partial class, which enables both the page and code files to be compiled into a single class at runtime. the page code refers to the code-behind file in the CodeFile attribute of the <% @ Page %> directive, specifying the class name in the Inherits attribute. note that members of the code behind class must be either public or protected (they cannot be private ).
C # CodeBehind Code Separation

The advantage of the simplified code-behind model over previous versions is that you do not need to maintain separate declarations of server control variables in the code-behind class. using partial classes (new in 2.0) allows the server control IDs of the ASPX page to be accessed directly in the code-behind file. this greatly simplifies the maintenance of code-behind pages.
This is indeed an improvement for development. Removing the server control statement in CodeBehind will make the code "refreshing" a lot, and it looks much more comfortable. See the example:
This is indeed an improvement for development. Removing the server control statement in CodeBehind will make the code "refreshing" a lot, and it looks much more comfortable. See the example:
We place a textbox on the page:
Test. aspx
<% @ Page language = "C #" CodeFile = "Test. aspx. cs" Inherits = "Test_aspx" %>
<Html>
<Head>
<Title> Test ASP. NET 2.0 </title>
</Head>
<Body>
<Form runat = "server">

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.