ASPX和aspx.cs文件之间的链接断开

编程入门 行业动态 更新时间:2024-10-20 03:29:07
本文介绍了ASPX和aspx.cs文件之间的链接断开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有同样的问题,几个不同的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文件之间的链接断开

本文发布于:2023-11-10 16:08:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575840.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:链接   文件   ASPX   aspx   cs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!