title: Control 'txtUserName' of type 'TextBox' must be placed inside a form tag with runat=server
body: <p>I have this error - Control 'txtUserName' of type 'TextBox' must be placed inside a form tag with runat=server. I am unable to get rid of it, my text box is placed inside a form tag with runat=server. </p>
  
  <p>The page which I am getting this on is my 'reset password' page I want the users to be able to enter their username and once they press the reset password button it takes them to a page which allows them to change their password. </p>
  
  <p>Here is the code that I am currently working with. </p>
  
  <pre><code>&lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;div style="font-family:Arial"&gt;
      &lt;table style="border: 1px solid black; width:300px"&gt;
          &lt;tr&gt;
              &lt;td colspan="2"&gt;
                  &lt;b&gt;Reset my password&lt;/b&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  User Name
              &lt;/td&gt;    
              &lt;td&gt;
                  &lt;form action="ChangePassword.aspx" method="get"&gt; 
                  &lt;asp:TextBox ID="txtUserName" Width="150px" runat="server" 
                  ontextchanged="txtUserName_TextChanged"&gt;
                  &lt;/asp:TextBox&gt;
  
                  &lt;/form&gt;
              &lt;/td&gt;    
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
  
              &lt;/td&gt;    
              &lt;td&gt;
                  &lt;asp:Button ID="btnResetPassword" runat="server" 
                  Width="150px" Text="Reset Password" onclick="btnResetPassword_Click" /&gt;
              &lt;/td&gt;    
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td colspan="2"&gt;
                  &lt;asp:Label ID="lblMessage" runat="server"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;    
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>