6

I'm not a fan of the Designer, I prefer to code straight to the ASPX page. However, since a reformat (and leading up to the reformat), the designer.cs files have not been updating correctly when manually coding to the .aspx file. This means my code behinds are not recognizing new controls and throwing compiler errors.

How can this be prevented or the designer.cs file to be forced to recompile after manually coding the aspx file? I know I can type the controls manually into the designer file, but this is time consuming and well, obnoxious when creating larger aspx pages.

Edit

WebDude's answer used to work, but switching to design view no longer solves the problem with any degree of consistency. Any more ideas?

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
ForCripeSake
  • 428
  • 1
  • 6
  • 11

6 Answers6

6

Simple solution,

Delete the designer.cs page, right click on the aspx/ascx page and choose Convert to Web Application.

and you are all set!!!

Bhavesh

Bhavesh
  • 61
  • 1
  • 1
5

This happened to me when I installed the sp1 in visual studio 2008. The way i got my code behind to recognise my controls was by viewing the aspx page in designer mode, then changing back to code view.

This seemed to give visual studio the slap it needed to start automatically populating my designers.

I realise your problem is in Vis 2005, but this could help you

Good Luck!

WebDude
  • 5,985
  • 5
  • 31
  • 42
0

In this related article, I just posted some information about my new tool, Redesigner. It's open-source, BSD license, available on SourceForge, and it generates designer files reliably without Visual Studio! (And without Visual Studio's bugs!)

You can download a copy here, or read more about it in the related article.

Community
  • 1
  • 1
Sean Werkema
  • 3,386
  • 1
  • 27
  • 36
0

I've found closing and reopening the page (both the HTML and code behind) forces it to repopulate everything.

user13810
  • 108
  • 5
0

I was having the same issue on a user control. By adding a new control - in my case a form view - to the page and building it forced it to regenerate the code behind.

0

Just reload the IDE and start from clean code backup.