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… 

More About the Author

Eric Shiarla

Managing Director, Americas
What the 2013 Tableau Customer Conference Means to InterWorks We’re less than a month away from the biggest Tableau event of the year: TCC13. If you’ve attended TCC in the past, especially last ...
Tableau Online – Cloud-Based Tableau Server Hosting Now Available Tableau Server is officially online. Users can now take advantage of their data from virtually anywhere with Tableau Online, a hosted ...

See more from this author →

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
Geschäftsführer: Mel Stephenson

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!