About aspx. designer. cs, aspx. designer. cs

Source: Internet
Author: User

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.

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.