title: ASP.NET page freezing
body: <p>So, I'm making an ASP.NET page in C#. I have a very simple form with 2 textboxes and 3 buttons on it. When I click a button for 'submit' it makes a call to an SQL Server database to retrieve some info. Once the data's retrieved, I have an if statement to check one of the loaded values. The problem is that the page seems to freeze after the button is clicked, and I can't click it again. I can still enter data in the textboxes, but the button doesn't show up as a LinkButton, the mouse icon doesn't change or anything. The code for the ASPX.CS page is below:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using CharacterSheet.BLL;
  using CharacterSheet.Data;
  
  public partial class Login : System.Web.UI.Page
  {
  
      protected void ClearButton_Click(object sender, EventArgs e)
      {
          UserBox.Text = "";
          PassBox.Text = "";
      }
  
      protected void SubmitButton_Click(object sender, EventArgs e)
      {
          PlayerController pc = new PlayerController();
          Player player;
  
          if (UserBox.Text.Contains('@') &amp;&amp; UserBox.Text.Contains(".c"))
              player = pc.GetByEmail(UserBox.Text);
          else
              player = pc.GetByUser(UserBox.Text);
  
  
          if (player != null)
          {
              if (!player.Flagged)
              {
                  if (PassBox.Text != player.Password)
                  {
                      ErrorLabel.Text = "Password does not match our records. Please retype carefully...";
  
                      player.LoginAttempts++;
  
                      if (player.LoginAttempts &gt;= 3)
                          player.Flagged = true;
  
                      pc.Update(player);
                  }
                  else
                      Response.Redirect(SiteData.LoginMainPage);
              }
              else
                  ErrorLabel.Text = "Your account has been flagged. Please e-mail our support team.";
          }
          else
              ErrorLabel.Text = "Unable to find user. Please retype carefully...";
      }
  }
  </code></pre>
  
  <p>And the code for the ASP markup page:</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server"&gt;
      &lt;style type="text/css"&gt;
          .leftColumn
          {
              text-align: right;
          }
          .style1
          {
              width: 30%;
              text-align: right;
              height: 47px;
          }
          .style2
          {
              width: 70%;
              text-align: right;
              height: 47px;
          }
      &lt;/style&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td class="leftColumn"&gt;
                  &lt;asp:Label ID="Label1" runat="server" CssClass="FormText" 
                      Text="Username or Email"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;asp:TextBox ID="UserBox" runat="server" ToolTip="Enter your username here"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                      ControlToValidate="UserBox" ErrorMessage="Username or Email is required" 
                      ForeColor="Red"&gt;*&lt;/asp:RequiredFieldValidator&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="leftColumn"&gt;
                  &lt;asp:Label ID="Label2" runat="server" CssClass="FormText" Text="Password"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;asp:TextBox ID="PassBox" runat="server" TextMode="Password" 
                      ToolTip="Enter your password here" TabIndex="1"&gt;&lt;/asp:TextBox&gt;
                  &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                      ErrorMessage="Password is required" ForeColor="Red" 
                      ControlToValidate="PassBox"&gt;*&lt;/asp:RequiredFieldValidator&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="style1"&gt;&lt;/td&gt;
              &lt;td class="style2"&gt;
                  &lt;asp:ValidationSummary ID="ValidationSummary" runat="server" 
                      CssClass="ValidationSumary" ForeColor="Red" Height="43px" 
                      style="text-align: left" Width="335px" DisplayMode="List" /&gt;
                  &lt;asp:LinkButton ID="SubmitButton" runat="server" CssClass="FormButton" 
                      TabIndex="2" onclick="SubmitButton_Click" PostBackUrl="~/Login.aspx"&gt;Submit&lt;/asp:LinkButton&gt;
                  &lt;asp:LinkButton ID="ClearButton" runat="server" CausesValidation="False" 
                      CssClass="FormButton" TabIndex="3" onclick="ClearButton_Click"&gt;Clear&lt;/asp:LinkButton&gt;
                  &lt;asp:LinkButton ID="NewAcctButton" runat="server" CausesValidation="False" 
                      CssClass="FormButton" TabIndex="4"&gt;Create Account&lt;/asp:LinkButton&gt;
                  &lt;br /&gt;
                  &lt;asp:Label ID="ErrorLabel" runat="server" ForeColor="Red" 
                      CssClass="FormErrorLabel"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>Thanks to anyone who can help with this! :-)</p>
  
  <p>EDIT: Upon further investigation (commenting out lines of code sequentially), I find that the problem arises when I update "ErrorLabel.Text". If I don't do that, then it functions just fine...this is confusing me a lot now...</p>