Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of aspx.designer.cs

Shulou Source: shulou.com Published: 2022-06-03 12:42:12 11月13日 Update

This article shares with you the content of the sample analysis of aspx.designer.cs. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Some instructions for .aspx file, .aspx.cs file and .aspx.designer.cs

.aspx file: (page) write the page code. What is stored is the page design code. Just put the code for each control, and the processing code is usually placed in a .cs file.

.aspx.cs file: (code behind page) write class code. What is stored is program code. It generally stores queries related to database connections and databases. Update. Delete operation, and the action that occurs after each button is clicked, and so on.

.aspx.designer.cs file: write page design code. What is usually stored is the configuration information of the controls in some page controls, that is, the registration control page. This is a code file generated by the form designer to initialize the controls on the form.

CodeBehind is used to bind the .aspx.cs file, and Inherits is used to bind the .designer file.

How to regenerate designer.cs files

The server control used in the aspx page will automatically generate a declaration of the control in this aspx.designer.cs. Sometimes it will appear in the aspx page that clearly uses a server control, and the id and Runat properties are added, but cannot be used in the background aspx.cs. At this time, you can check the declaration statement for this control in aspx.designer.cs and check whether the control type and id are the same as those in aspx.

Vs 2003 used to put this part of the code into the cs file of the form, because this part of the code generally does not need to be modified manually, separate it after vs 2005 to form a designer.cs file corresponding to the form. In this way, the remaining code in the cs file is highly related to the function of the program to facilitate maintenance.

If the desiger.cs is incorrect, or if you delete this file by mistake, you can regenerate it in the following ways:

Delete the designer.cs file, then select the project, right-click, and select convert to web Application. A new synchronized desinger.cs is automatically generated.

Prompt

There are two types of Web projects, one kind of WebSite does not generate designer.cs, and the other kind of WebApplication generates this file.

Thank you for reading! This is the end of this article on "sample Analysis of aspx.designer.cs". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Files code controls pages builds forms programs examples analysis content data databases more servers articles automatic generation projects storage services check Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MySQL Microsoft Linux vpn