title: How to hide this error message after a couple of seconds?
body: <p>I am developing a simple registration system in which all the events will be listed in a GridView and the user will be able click on register in the event by clicking on the Register button that will be displayed besides the event. The is working fine but I only have one problem with it which is the following:
  When the user tried to register in one of the events that he is already registered in it, he will get an error message under the GridView. The problem this message will be displayed all the time event when he registered in another evenet successfully. What I want is just showing this message for a couple of seconds. </p>
  
  <p><strong>So how to do that?</strong></p>
  
  <p>Here's my code in ASP.NET:</p>
  
  <pre><code>&lt;asp:GridView ID="ListOfAvailableEvents_GrivView" runat="server" AutoGenerateColumns="False"
          DataKeyNames="ID" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333"
          GridLines="None" AllowPaging="True" PageSize="10" 
          onrowdatabound="ListOfAvailableEvents_GrivView_RowDataBound"&gt;
      &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
      &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" CssClass="generaltext" /&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField HeaderText=""&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:LinkButton ID="lnkTitle" runat="server" CssClass="button" Text="Book &amp;rarr;" OnClick="lnkTitle_Click"&gt;&lt;/asp:LinkButton&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /&gt;
          &lt;asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" /&gt;
          &lt;asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" /&gt;
          &lt;asp:BoundField DataField="StartDateTime" HeaderText="Start Date &amp; Time" SortExpression="StartDateTime" /&gt;
          &lt;asp:BoundField DataField="EndDateTime" HeaderText="End Date &amp; Time" SortExpression="EndDateTime" /&gt;
      &lt;/Columns&gt;
      &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
      &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
      &lt;HeaderStyle Font-Bold="True" CssClass="complete" /&gt;
      &lt;EditRowStyle BackColor="#999999" /&gt;
      &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
      &lt;EmptyDataTemplate&gt;&lt;h2&gt;No Events Available&lt;/h2&gt;&lt;/EmptyDataTemplate&gt;
  &lt;/asp:GridView&gt;
  
  &lt;span id="errorSpan" runat="server" style="color:Red;"&gt;&lt;/span&gt;
  
  
  &lt;asp:Button ID="btnModalPopUp" runat="server" Style="display: none" /&gt;
  &lt;ajaxToolkit:ModalPopupExtender ID="modalPopupExtender1" runat="server" TargetControlID="btnModalPopUp"
      PopupControlID="pnlPopUp" BackgroundCssClass="popUpStyle" PopupDragHandleControlID="panelDragHandle"
      OkControlID="OKButton"&gt;
  &lt;/ajaxToolkit:ModalPopupExtender&gt;
  &lt;asp:HiddenField ID="HiddenField1" runat="server" /&gt;
  
  &lt;asp:Panel ID="pnlPopUp" runat="server" CssClass="popUpStyle"&gt;
      &lt;%--&lt;asp:Label ID="lblQuestion" runat="server" Text="Are you sure you want to register in" /&gt;--%&gt;
      &lt;table class="tableClass" width="400px"&gt;
          &lt;tr&gt;
              &lt;th valign="middle" colspan="2" align="center" bgcolor="#99CCFF" style="font-weight: bold;
                  font-size: larger"&gt;
                  Event Details
              &lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="thClass"&gt;
                  Title:
              &lt;/td&gt;
              &lt;td class="tdClass"&gt;
                  &lt;asp:Label ID="lblTitle" runat="server"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="thClass"&gt;
                  Description:
              &lt;/td&gt;
              &lt;td class="tdClass"&gt;
                  &lt;asp:Label ID="lblDescription" runat="server"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="thClass"&gt;
                  Location:
              &lt;/td&gt;
              &lt;td class="tdClass"&gt;
                  &lt;asp:Label ID="lblLocation" runat="server" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="thClass"&gt;
                  Start Date &amp; Time:
              &lt;/td&gt;
              &lt;td class="tdClass"&gt;
                  &lt;asp:Label ID="lblStartDateTime" runat="server" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td class="thClass"&gt;
                  End Date &amp; Time:
              &lt;/td&gt;
              &lt;td class="tdClass"&gt;
                  &lt;asp:Label ID="lblEndDateTime" runat="server" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;center&gt;
      &lt;asp:Button ID="confirmButton" runat="server" Text="Register" OnClick="btnSendConfirmationEmail_Click" /&gt;
      &lt;asp:Button ID="OKButton" runat="server" Text="Cancel" /&gt;&lt;/center&gt;
  &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>C# code-behind:</p>
  
  <pre><code>protected void btnSendConfirmationEmail_Click(object sender, EventArgs e)
  {
      int eventID = Convert.ToInt32(HiddenField1.Value);
      if (!UserHasBooking(userNetworkID, eventID))
      {
          checkUserID(userNetworkID, eventID);
  
          SmtpClient sc = new SmtpClient("Mail Server");
          StringBuilder sb = new StringBuilder();
          MailMessage msg = new MailMessage();
  
          //Variables for retrieving the Booking Information
          string title = lblTitle.Text;
          string description = lblDescription.Text;
          string location = lblLocation.Text;
          string startDateTime = lblStartDateTime.Text;
          string endDateTime = lblEndDateTime.Text;
  
          //Message Information
          string toAddress = userNetworkID + "@mailserver.com";
          string fromAddress = "Test@MailServer.com";
          string mailSubject = "Registration Notification: " + title + " (" + startDateTime + " - " + endDateTime + ")";
          string messageBody = "............";
  
          try
          {
              msg.To.Add(toAddress);
              msg.From = new MailAddress(fromAddress, "Registration System");
              msg.Subject = mailSubject;
              msg.Body = messageBody;
              msg.IsBodyHtml = true;
              sc.Send(msg);
          }
  
          catch (Exception ex)
          {
              throw ex;
              // something bad happened
              //Response.Write("Something bad happened!");
          }
  
          finally
          {
              if (msg != null)
              {
                  msg.Dispose();
              }
          }
      }
      else
      {
          errorSpan.InnerText = "You already have a booking in this event";
      }
  }
  </code></pre>
  
  <p>The error message is:
   errorSpan.InnerText = "You already have a booking in this event";</p>
  
  <p><strong>So how to fix that?</strong></p>