Broken link between aspx and aspx.cs files

I had the same problem several times with different ASPX pages after renaming them, and I am surprised that I cannot find anyone else with the same problem in stackoverflow.

When I start an ASP.NET C # project, the debugger gives me a message like this.

Error   5   The name 'txtTitle' does not exist in the current context

It seems that the aspx and aspx.cs files are no longer linked. The only fix I found for this is to recreate the page and copy / paste my code.

Any idea how to fix this without recreating all this?

thank

+3
source share
4 answers

, ASPX. , ASPX , .

<%@ Page Title="TestPage" Language="C#"  AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" %>

, , . , codecs.cs. .

, ASP.NET, .

+6

, Silverlight - .

aspx ?

this util, .

+1

, whatever.aspx.designer.vb whatever.aspx.vb whatever.aspx. , Visual Studio. , , - , .

( #.)

+1

, , , , CodeFile .aspx . , :

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyClass.aspx.cs" Inherits="MyClass" %>
                                                        ^^^^^^^
0

Source: https://habr.com/ru/post/1771617/


All Articles