Adding items on an aspx page doesn't cause them to be created in the code behind.

J

JB

I have existing aspx pages that I'm editing in VS 2005 that I add a server
control to - like a label. I include the runat="server" and it doesn't seem
to create the reference in the code behind for it.

Is there any way to have it automatically generate the code behind?

Also - when I look in the .aspx.designer.cs file, there are lots of
references to things that were there but have been deleted.

Any thoughts?

TIA - Jeff.
 
B

BusEdge

I have existing aspx pages that I'm editing in VS 2005 that I add a server
control to - like a label. I include the runat="server" and it doesn't seem
to create the reference in the code behind for it.

Is there any way to have it automatically generate the code behind?

Also - when I look in the .aspx.designer.cs file, there are lots of
references to things that were there but have been deleted.

Any thoughts?

TIA - Jeff.

In VS2003 all references to server controls got generated in the
single code behind file once you viewed the page in design view. In
VS2005 the code behind uses a partial class and is split to 2 files,
the .cs and the .designer.cs files. MS moved all those control
references into the designer file so that the plain .cs file would be
less cluttered (and perhaps to show off the whole partial class
thing). Both files are used to process the page, and VS2005 _does_
generate control references in the designer file automagically. In my
experience, it does keep the list updated so if you delete from the
aspx page it removes the reference in the designer file.

-Brandon
==================
http://www.busedge.com
 
J

JB

Actually I found out the solution. The pages had been 1.1 and I 'converted'
them to 2.0. I then had to run 'Convert to Web Application' ( or something
like that ) on each page so that it would then work correctly. Once I did
that - it worked fine.

Thanks anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top