Force Regeneration of the Designer.cs File

Dev

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

Director of BI Markets and Delivery
Tableau Driver’s Ed: Creating a Center of Evangelism In the previous article of Driver’s Ed, we covered the four phases of the Drive methodology to build an analytics culture step-by-step. ...
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 ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

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