About aspx. designer. cs, aspx. designer. cs
Description of. aspx file,. aspx. cs file, and. aspx. designer. cs
. Aspx file: (PAGE) write page code. The page design code is stored. Only the code of each control is put, and the processing code is generally put in the. cs file.
. Aspx. cs file: (code hidden page) writing class code. Program code is stored. Generally, queries related to database connections and databases are stored. Update. Delete operations, as well as actions that occur after the buttons are clicked.
. Aspx. designer. cs file: Write the page design code. The configuration information of some page controls is usually stored, that is, the registration control page. The code file generated by the Form Designer is used to initialize controls on the form.
<% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "Document. aspx. cs" Inherits = "admin).web. Document" %>
CodeBehind is used to bind the. aspx. cs file, and Inherits is used to bind the. designer file.
How to regenerate the designer. cs File
The server controls used on the aspx page are all in this aspx. designer. cs automatically generates a Declaration on the Control. Sometimes a server control is used on the aspx page, and the id and Runat attributes are added, but the backend aspx is used. cs cannot be used. In this case, you can check aspx. designer. declare the control in cs to check whether the control type and id are consistent with those in aspx.
Previously, vs 2003 put this part of code in the cs file of the form. Because this part of Code generally does not need to be manually modified, it will be separated to form a designer after vs 2005. the cs file corresponds to the form. In this way, the remaining code in the cs file is code that is highly relevant to program functions for maintenance.
If desiger. cs is incorrect or the file is deleted by mistake, use the following method to regenerate the file:
Delete the designer. cs file, select the project, right-click it, and select "convert to web application ". A new synchronized desinger. cs is automatically generated.
Prompt
There are two types of Web projects: one is WebSite that does not generate designer. cs, and the other is WebApplication that generates this file.
See the difference between WebSite and WebApplication.