title: "The name does not exist in the current context" in ASPX page
body: <p>I've had a look at similar questions (<a href="https://stackoverflow.com/questions/706603/the-name-controlname-does-not-exist-in-the-current-context">1</a>,<a href="https://stackoverflow.com/questions/19027025/name-does-not-exist-in-the-current-context">2</a>) but they don't appear to provide me a solution :S</p>
  
  <p>I'm trying to add an extra field to a registration form that is already pre-built (i.e. comes with) in ASP.Net Web Form.</p>
  
  <p>What I'm doing is, in the <code>Register.aspx.cs</code> backend I try to obtain the value <code>txtCompanyInput.Text();</code>:</p>
  
  <pre><code>    protected void RegisterUser_CreatedUser(object sender, EventArgs e)
      {
         ... // some code here 
  
         String CompanyName = txtCompanyInput.Text();
  
         ... // other code here
  
         Response.Redirect(continueUrl);
      }
  </code></pre>
  
  <p>The <code>Register.aspx</code> itself looks like so:</p>
  
  <pre><code>    ...
      &lt;li&gt;
          &lt;asp:Label runat="server" AssociatedControlID="ConfirmPassword"&gt;
             Confirm password&lt;/asp:Label&gt;
          &lt;asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" /&gt;
          &lt;asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword"
             CssClass="field-validation-error" Display="Dynamic"
             ErrorMessage="The confirm password field is required." /&gt;
          &lt;asp:CompareValidator runat="server" ControlToCompare="Password" 
             ControlToValidate="ConfirmPassword"
             CssClass="field-validation-error" Display="Dynamic"
             ErrorMessage="The password and confirmation password do not match." /&gt;
      &lt;/li&gt;
      &lt;li&gt;
             &lt;asp:TextBox ID="txtCompanyInput" runat="server"&gt;&lt;/asp:TextBox&gt;
      &lt;/li&gt;
      ...
  </code></pre>
  
  <p>When I try to build the project I run into an error saying:</p>
  
  <p><code>Error  1   The name 'txtCompanyInput' does not exist in the current context    c:\users\...\Account\Register.aspx.cs   62  34  ProjectTest</code></p>
  
  <p>Is there a reason why I'm not able to reference the <code>txtCompanyName</code> field in the backend?</p>