views:

11

answers:

1

Greetings, How to duplicate asp page in visual studio 2008?

If I copy and paste the page I want in new folder in the same project the rename the copied asp page with new name I will have this kind of error:

Error 1 The type 'IMAM_APPLICATION.AddContact' already contains a definition for 'cmbStateWork' C:\Users\A\Documents\Visual Studio 2008\Projects\IMAM_APPLICATION\IMAM_APPLICATION\private\AddContactPrivate.aspx.designer.cs 23 66 IMAM_APPLICATION

and this error will repeated for all the controls I have in the page.

my page has more than 40 controls so it is really hard to rewrite and write the code again and I need similar page with same controls.

Is there a way to duplicate asp page in the same project??

+1  A: 

Merely renaming the page does not change the class of the page. You must also change the CodeBehind or CodeFile attribute of the @Page directive.

My approach to this is to create a new page (with a different name or in a different folder) and copy only the controls from the source page into the new page. This way, I don't forget to change the @Page directive.