Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I created a web application and transferred the code from an existing asp.net project. When I compiled it, I received hundreds of errors like: The name of 'ControlName' does not exist in the current context. Willing to get hints to solve this kind of problem. Thanks.
Posted
Comments
Sergey Alexandrovich Kryukov 15-Feb-14 6:06am    
What hint? It does not exist, that's it. Ask yourself why did you write something which does not exist in the context of writing. You wrote it, no one else. And learn the basics.
—SA
Hareesh Malli 15-Feb-14 6:13am    
Exactly man. I think he don't know the minimum basics.
[no name] 15-Feb-14 19:17pm    
Sorry I did not describe my problem well so that got some reviewers confused. The scenario is that I created a file-system project several months ago. I created dozens of webpages in it and published in our IIS6. To do some enhancement, it was found that the project would be better in Web Application. Then I re-created an empty Web Application project and transferred all of the files in the existing file-system project to the new one. Unfortunately, I got near 200 errors as shown in the thread. I wish this description could clear the confusion by some reviewers. Thanks.

1) Go back to the original application.
2) Find the first control your error list shows as "does not exist" in the new project.
3) Copy it.
4) Paste into your new application.
5) Repeat from (1) until errors disappear.
 
Share this answer
 
Comments
[no name] 15-Feb-14 6:15am    
Tried but not working. The code is identical to the original one. I wonder it is some setup related. Wish to get your additional hint. Thanks.
OriginalGriff 15-Feb-14 6:19am    
"Code" is only half of it: go back and look for all references - there will be an ASPX file or similar as well...
[no name] 15-Feb-14 6:20am    
Thanks. I am check references one by one.
CSS
My problems got solved by referring to the thread at http://stackoverflow.com/questions/706603/the-name-controlname-does-not-exist-in-the-current-context/1981228#1981228[^].
What I did was to Right-click on the parent aspx file. In the pop-up menu, select Convert to Web Application. Then, re-compiled the project.
Thanks for all of reviewers who posted their comments and provided possible solutions.
 
Share this answer
 
exclude any other pages that reference the same code-behind file, for example an older page that you copied and pasted.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900