Connecting Tech Pros Worldwide Help | Site Map

Control does not exist in the current context

  #1  
Old July 4th, 2009, 04:25 AM
Newbie
 
Join Date: Sep 2007
Posts: 21
G'day,

I have encontered what appears to be a common problem, but unfortunately the typical solution i have found has not worked for me.

I have just copied the files from an "ASP .NET Web Site" to an "ASP .NET Web Application" because i have learned about the differences and have decided to move to the latter. I simply copied and pasted all the .aspx (with respective .aspx.cs code-behind files) and some other files such as scripts etc into the "Web Application". I have also added the same references to class libraries I had in the "Web Site".

When I come to compile the "Web Application", I get errors saying that controls "cannot be found in the current context". I did not get these errors in the "Web Site" and the common problem apparently is that there are backup files or duplicate partial classes, which i'm certain is not the case for me...

One example is that I have an ASP:PlaceHolder in header.aspx as follows...

<asp:Placeholder runat="server" ID="headermenuholder">

...but i get the error "The name 'headermenuholder' does not exist in the current context"

I would be VERY greatful if someone could give me their opinion! :)

Best Regards,
Chris
  #2  
Old July 4th, 2009, 05:14 AM
Newbie
 
Join Date: Sep 2007
Posts: 21

re: Control does not exist in the current context


Sorted.

Turned out i wasn't aware that in "ASP .NET Web Application" projects there needed to be both .cs and .designer for each page. I created a new page by going to add item and the correct .designer page was created, so i copied the code from the old version, deleted the old version and recompiled and it worked!

Thanks anyway :)
  #3  
Old July 4th, 2009, 05:16 AM
Newbie
 
Join Date: Sep 2007
Posts: 21

re: Control does not exist in the current context


Even Better!

Right click on the file and choose "Convert to Web Application" - feel a bit silly now!

Thanks
  #4  
Old July 5th, 2009, 06:06 PM
Newbie
 
Join Date: Aug 2008
Posts: 17

re: Control does not exist in the current context


ok, u got it, and nice to share with us
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
"the name <some control> does not exist in the current context" avecreep answers 2 August 5th, 2008 06:39 PM
"the name <some control> does not exist in the current context" avecreep answers 1 August 5th, 2008 08:33 AM
Invoke does not exist in the current context The.Relinator@gmail.com answers 2 September 20th, 2006 12:35 AM
Textbox in User Control error -does not exist in current context aarepasky@yahoo.com answers 2 May 21st, 2006 10:45 PM