title: How to access html controls in code behind
body: <p>I'm trying to follow this <a href="http://www.asp.net/web-forms/tutorials/security/membership/validating-user-credentials-against-the-membership-user-store-cs">example</a> on how to validate credentials. However, it uses asp: controls for the login form.</p>
  
  <p>If I were to use html controls instead so CSS styles can be applied, eg</p>
  
  <pre><code>&lt;div id="login"&gt;
  &lt;a href="#" id="lclose"&gt;&lt;/a&gt;
  
          &lt;form action="#" runat="server"&gt;
              &lt;fieldset&gt;
                  &lt;div class="frame"&gt;
                      &lt;h4&gt;Login&lt;/h4&gt;
                      &lt;small&gt;Sign in to your account.&lt;/small&gt;
                      &lt;div class="clear"&gt;&lt;/div&gt;
                      &lt;input type="text" value="Username" class="input-text autoclear" /&gt;
                      &lt;input type="password" value="Password" class="input-text autoclear"/&gt;
                  &lt;/div&gt;
  
                  &lt;div class="separator"&gt;&lt;/div&gt;
  
                  &lt;div&gt;
                  &lt;input type="submit" value="Sign in" class="input-submit float-right" runat="server" onserverclick="LoginButton_Click"/&gt;
                  &lt;a href="#" class="float-left"&gt;Forgot your password?&lt;/a&gt;
                  &lt;/div&gt;
  
              &lt;/fieldset&gt;
          &lt;/form&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I access the Username &amp; Password in code behind similar to? </p>
  
  <pre><code>protected void LoginButton_Click(object sender, EventArgs e)
  {
      // Validate the user against the Membership framework user store
      if (Membership.ValidateUser(UserName.Text, Password.Text))
      {
          // Log the user into the site
          FormsAuthentication.RedirectFromLoginPage(UserName.Text, RememberMe.Checked);
      }
      // If we reach here, the user's credentials were invalid
      InvalidCredentialsMessage.Visible = true;
  }
  </code></pre>
  
  <p>What is the correct syntax instead of <code>UserName.Text, Password.Text</code>?</p>