Research on aspx. designer. cs, aspx. designer. cs

Source: Internet
Author: User

Research on 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.


C # What is aspxdesignercs?

The server control used on the ASPX page will automatically generate a Declaration on the Control in this aspx. designer. cs.
Sometimes a server control is used on the ASPX page, and the ID and RUNNAT 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.

How does vs2008 generate aspxdesignercs files?

Designer. cs is a code file generated by the Form Designer. It initializes controls on the form (in the InitializeComponent () function) previously, VS2003 put this part of code into the cs file of the form. Because this part of code does not need to be manually modified, VS2005 will separate it to form a designer. 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.

Why is there no. aspx. designer. cs file for the project I created using vs2008? How can I configure it for display?

There are two types of web projects. One website does not generate designer. cs, another web application generates this file, so some netizens may not understand it. Let's briefly introduce the differences between WebSite and WebApplicationd in VS2005, hope to help you.

Advantages of the WebApplication programming model:

● The website Compilation speed is fast and the incremental compilation mode is used. This part will be incrementally compiled only after the file is modified.
● Generated assembly

WebSite: generate a random Assembly name. You must use the plug-in WebDeployment to generate a single assembly WebApplication: You can specify a WebSite project to generate a single assembly because it is an independent assembly, therefore, like other projects, you can specify the application Assembly name, version, output location, and other information.
● The website can be split into multiple projects for convenient management
● A file can be excluded from the project and source code management.
● Support for VSTS Team Build to facilitate daily building
● More powerful code check functions, and check policies are controlled by source code
● You can perform prescribed processing before and after compilation
● Strong Resource class support for App_GlobalResources
● Directly upgrade a large system built using VS2003

Advantages of the WebSite programming model:

● Dynamically compile the page to see the effect immediately without compiling the entire site (main advantages)
● Same as above, which can make the error part irrelevant to the used part
● An assembly can be generated on each page.
● A directory can be processed as a Web application, and files can be directly copied and published without project files
● You can also compile the page into a set of programs.

Mutual conversion between the two programming models:

VS2005 SP1 has built-in Conversion Program, which can be easily converted from WebSite to WebApplication
You only need to copy the file and right-click to execute "convert to Web application.

No dedicated reverse Conversion Tool is found, but after comparison, it is also very easy to convert.
*. Designer. cs
*. Aspx
*. Ascx
*. Master
Delete all *. designer. cs
Replace Codebehind = "FileList. aspx. cs" in the *. aspx, *. ascx, and *. master page files with CodeFile = "FileList. aspx. cs" in batches"

In short, large websites are more suitable for WebApplication projects, while small websites are more suitable for WebSite projects.
Lao Yang [authoritative expert]

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.