.aspx file: (page) writes the page code. What is stored is the page design code. Just put the code of each control, and the processing code is usually placed in the .cs file.
.aspx.cs file: (code-behind page) to write class code. What is stored is program code. Generally stores queries related to database connections and databases. renew. Delete operations, as well as actions that occur after clicking each button, etc.
.aspx.designer.cs file: writes page design code. Usually, the configuration information of controls in some page controls is stored, which is the registration control page. This thing is a code file generated by the form designer, and its function is to initialize the controls on the form.
<%@ Page Language="C#" AutoEventWireup ="true" CodeBehind="Document .aspx.cs" Inherits="Admin10000.Web.Document" %>
CodeBehind is used to bind .aspx.cs files, and Inherits is used to bind .designer files.
The server controls used in aspx pages will automatically generate declarations for the controls in aspx.designer.cs. Sometimes it will appear in the aspx page that a server control is clearly used, and the id and Runat attributes are added, but in the background It cannot be used in aspx.cs. In this case, you can check the declaration statement of this control in aspx.designer.cs and check whether the control type and id are consistent with those in aspx.
Before VS 2003, this part of the code was placed in the cs file of the form. Since this part of the code generally does not need to be modified manually, after VS 2005, it was separated to form a designer.cs file corresponding to the form. In this way, the remaining codes in the cs file are codes that are highly relevant to program functions, which is easier to maintain.
If the designer.cs is wrong, or the file is deleted by mistake, you can regenerate it using the following method:
Delete the designer.cs file, then select the project, right-click and select "Convert to web application". A new synchronized desinger.cs will be automatically generated.
There are two types of Web projects, one is WebSite that does not generate designer.cs, and the other is WebApplication that only generates this file.
Please refer to the difference between WebSite and WebApplication
The above is the detailed content of About aspx.designer.cs. For more information, please follow other related articles on the PHP Chinese website!