Force Regeneration of the Designer.cs File

Force Regeneration of the Designer.cs File

//

At times while developing an ASP.NET project you may run into the following error in your code behind file:

The name ‘controlName’ does not exist in the current context

Often this is simply a case of a misnamed control or an error in your .aspx file. Other times, however, the problem can be due to an invalid designer.cs file.

Designer.cs Voodoo

Usually when you modify an .aspx file Visual Studio will update the accompanying designer.cs file with any new controls which have been added or modified. I emphasize usually because at times the designer.cs file doesn’t update at all. You can create and update all the controls you’d like but it makes absolutely no difference.

Regenerating the Designer.cs File

In these cases I’ve found regenerating the designer.cs file to the best route to take. Nobody wants to, or should have to, modify the designer.cs file by hand. Regenerating the file only takes two simple steps:

  1. Delete the current designer.cs file
  2. Right click on the .aspx file and choose Convert to Web Application

That’s it! And it was so obvious all along… 

Need Expert Help?

See Our Full Menu of Data Services

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072

×

Love our blog? You should see our emails. Sign up for our newsletter!