By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,617 Members | 1,600 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,617 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
Mar 2 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mar 2, 1:01 pm, "JB" <j...@nowhere.comwrote:
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
Mar 2 '07 #2

P: n/a
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.

"BusEdge" <sp*****@gmail.comwrote in message
news:11**********************@z35g2000cwz.googlegr oups.com...
On Mar 2, 1:01 pm, "JB" <j...@nowhere.comwrote:
>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


Mar 7 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.