views:

2651

answers:

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?

+5  A: 

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
Fantastic! This issue was driving me crazy. Thanks for the tip.
Nip
no problem, glad it helped. Visual Studio 2010 has not given me thid problem at all.
WebDude
A: 

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

+5  A: 

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
A: 

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.

Christina
A: 

Just reload the IDE and start from clean code backup.

Arsenty
A: 

I had the same problem and Bhavesh's instructions worked for me.

DrewBowman