Adding new controls to upgraded pages

G

Guest

I upgraded a web application into a VS 2005/.NET 2.0 Web Application Project
(as opposed to a Website project), but did not set the pages to be partial
classes.

Looking at the code behind, you can see the declarations of all the controls
as it was in Visual Studio 2003. But when I add a new control, VS doesn't add
the new declare in the code behind, and before you can reference the control,
you manually have to add the declaration in the code behind.

I understand if the class was a partial class, but I don't understand why
this is happening. Is this correct? Is this the way that VS handles the
addition of controls in a Web Application Project?
 
S

Sergey Gorbachev

before you can reference the control,
you manually have to add the declaration in the code behind.

It is wrong. You do not need to add the declaration. Are you sure you are
using partial classes to code behind?
 
G

Guest

Are you sure you are using partial classes to code behind?

I'm not using partial classes. But I did change one form to use partial
classes. After adding a new control, it still didn't add it in the declares
section but I could reference it in code (intellisense).

The only problem is that if you have a form with many controls, it's
difficult to remember the control name so now you are forced to look at the
properties in aspx where as if it was added to the declares, all you needed
to do is scan them and find the name by looking at the type - much quicker.
 
S

Sergey Gorbachev

I think the converter did something wrong. If I were you, I'd just recreate
the forms manually (they will be partial classes) and copy-paste all code
from the converted ones (excluding the controls declaration in code-behind -
you don't need this in VS2005).
 
G

Guest

That would probably fix it, but unfortunately there are just too many files.
Maybe if I can extend the project.....

Thanks
 

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

Top