About the relationship between. aspx and. aspx.cs

Source: Internet
Author: User

At the beginning of the time did not care, now found still know the point of good .... Google's ~ ~ ~

Find a clearer explanation of the passage:

The ASPX and the corresponding. Aspx.cs are a page code, and the page is basically only responsible for displaying the format, and all server-side actions are defined in the Aspx.cs. That is, they are actually two sides of a thing,all server-side controls in ASPX can be used in the corresponding aspx.cs, and vice versa , and of course you can define the corresponding action, and if you develop it in the IDE, you do not need to do any extra work. And after compiling,Aspx.cs becomes the DLL in the bin directory, and the ASPX file does not change, only need to put the ASPX and DLL on the release, CS file as the original code does not need to be published.

ASPX is the foreground, which represents the design page, aspx. CS is the backstage, is the code function realization, separates to design is for the code clear, the function modularization,

This is the code-behind structure, which is the code behind the page HTML.

In the. aspx file, it is primarily the HTML of the page;
In the. aspx.cs file, is the C # code, the event of the control added in. aspx, and its code is in. aspx.cs.
To make an inappropriate analogy:
The content of the. aspx page is like a static Web page (. htm,.html) that we usually make up--not exactly the same, of course.
The content in the. Aspx.cs is much like the software we develop under the Windows platform (such as DELPHI,VC, etc.)-not exactly the same, of course.

And in-depth research it seems I still a little indefinitely. But put it on:

The Aspx.cs file contains a class (for example, WebForm1) that is ASP when you request the page from the server. NET will be the class in the Aspx.cs as the base class, the current page (aspx file) and the base class, compile a new class (for example, b), and then by the class B production object generated in the server-side HTML file sent to the client, so this is an inheritance, you can see the following language at the beginning of the ASPX file can be explained This: <%@ page language= "C #" codebehind= "WebForm1.aspx.cs" autoeventwireup= "false" inherits= "webapplication1.we BForm1 "%> inherits=" Webapplication1.webform1 "illustrates this kind of inheritance relationship.

Further research in detail see http://www.cnblogs.com/axzxs2001/archive/2009/01/19/1378383.html

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.