简体   繁体   中英

Problems of designer file in asp.net

Whenever I open an existing project in VS 2005, the designer.cs files do not show up under .aspx files, and due to this when I add controls in .aspx the designer.cs is not updated.

Below is how the structure looks:

+----AAAConfirm.aspx
.  .
.  ..AAAConfirm.aspx.cs
.
.----AAAConfirm.aspx.designer.cs

You need to "show all files" for the project, it most likely got removed from the project file by accident. When you see the file in Visual Studio, right click the file and select "Add to Project".

Or

Check the project file and make sure the designer file's compile tag has a child element called DependentUpon

The XML section specifying the file's inclusion in the project should look something like this

<Compile Include="AAAConfirm.aspx.designer.cs">
    <DependentUpon>AAAConfirm.aspx</DependentUpon>
</Compile>

Also check that the markup page AAAConfirm.aspx has the correct codebehind and inherit reference in the <%Page> tag. Did you maybe change namespaces? Try setting the Inherits attribute value to the class name without the namespace.

Copy your project to some other folder and

  • Locate the corrupted aspx.designer.cs file through the Solution
  • Explorer Delete only the designer.cs file from your project
  • Rightclick your main aspx file and select “Convert to Web Application“.

Ref : Tip: regenerate aspx.designer.cs files when corrupted

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM