名称为“控件名称'不在当前上下文中存在 [英] The name 'controlname' does not exist in the current context
问题描述
我有我工作的一个Web应用程序(ASP.NET2.0用C#,使用VS2005)。一切工作正常,和所有突然我得到的错误:
I have a web application that I'm working on (ASP.NET2.0 with C#, using VS2005). Everything was working fine, and all of a sudden I get the error:
错误1'Label1的'这个名字并不在目前的情况下存在
和其他43排序,我在页面我的codebehind使用的控制每次的。
and 43 others of the sort for each time that I used a control in my codebehind of the page.
这是仅发生1页。而且这好像codebehind是不承认的控件。另一个有趣的事情是,智能感知不拿起任何控件要么..
This is only happening for 1 page. And it's as if the codebehind isn't recognizing the controls. Another interesting thing is that the intellisense isn't picking up any of the controls either..
我试图清理解决方案文件,删除OBJ文件,排除项目中的文件,然后重新添加它们,关闭VS并重新启动它,甚至重新启动计算机,但这些都没有工作过。
I have tried to clean the solution file, delete the obj file, exclude the files from the project then re-add them, close VS and restart it, and even restart my computer, but none of these have worked.
推荐答案
检查隐藏文件名和继承财产的@Page指令的code,确保它们都匹配。
Check your code behind file name and Inherits property on the @Page directive, make sure they both match.
这篇关于名称为“控件名称'不在当前上下文中存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!