title: Aspx.cs doesn't recognize controls declared in aspx?
body: <p>I created a branch new web project:
  File -> New -> Project  -> ASP.NET Web Application</p>
  
  <p>Then I tried to add a simple control asp:Label but the aspx.cs doesn't recognize this declaration for some reasons. I didn't make any changes to the default project. It contains 6 pages:</p>
  
  <p><img src="https://i.stack.imgur.com/NAEex.png" alt="enter image description here"></p>
  
  <p>Does anyone know what could cause this issue? Thanks.</p>
  
  <p><strong>EDIT</strong><br>
  Here what I added to the file <code>About.aspx</code> is a label with id = <code>id1</code></p>
  
  <pre><code>&lt;%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
      CodeBehind="About.aspx.cs" Inherits="WebApplication2.About" %&gt;
  
  &lt;asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&gt;
      &lt;asp:label ID="id1" runat="server" &gt;A Label&lt;/asp:label&gt;
      &lt;h2&gt;
          About
      &lt;/h2&gt;
      &lt;p&gt;
          Put content here.
      &lt;/p&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>I ran the project without calling that variable <code>id1</code>, everything works fine. </p>
  
  <p><img src="https://i.stack.imgur.com/WfpU8.png" alt="enter image description here"></p>
  
  <p>But if I called <code>id1</code> within <code>About.aspx.cs</code>, it gave me error said the variable was not found.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  namespace WebApplication2 {
      public partial class About : System.Web.UI.Page {
          protected void Page_Load(object sender, EventArgs e) {
              id1.Text = "What the heck?";
          }
      }
  }
  </code></pre>