我有同样的问题,几个不同的ASPX页面时间对其进行重命名后,我很惊讶,我不能找别人与计算器同样的问题。
I've had the same problem a couple of times with different ASPX pages after renaming them and I am surprised that I can't find someone else with the same problem on stackoverflow.
当我运行我的ASP.NET C#项目,调试器给了我这样一个消息。
When I run my ASP.NET C# project, the debugger gives me a message like this one.
Error 5 The name 'txtTitle' does not exist in the current context看来,ASPX和aspx.cs文件时不再绑定。我发现这样做的唯一的解决方法是重新创建的页面和复制/粘贴我的code。
It seems that the aspx and aspx.cs files at no longer bound. The only fix I have found for this is to recreate the page and copy/paste my code.
不知道如何解决这一问题而无需重新创建整个事情?
Any idea how to fix this without recreating the whole thing?
感谢
推荐答案在code文件包含在ASPX头声明中引用的部分类。这两个文件的名称,并在ASPX头实际的类必须匹配这个工作。
The code file contains a partial class that is referenced in the ASPX header declaration. Both file name and the actual class in the ASPX header have to match for this to work.
<%@ Page Title="TestPage" Language="C#" AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" %>在你的情况可能是类名不匹配。检查在codebehind cs文件的类名后的名称相匹配的继承
In your case probably the class name does not match. Check if the class name in the codebehind .cs file matches the name after Inherits.
在ASP.NET中使用部分类的概念是详细这里。
The concept of partial classes used in ASP.NET is detailed here.
更多推荐
ASPX和aspx.cs文件之间的链接断开
发布评论