Events: clear log container


Info
   1:  <%@ Page Language="C#" Title="AtomicButton -- Server Side Events" AutoEventWireup="true" CodeBehind="ServerSideEvents.aspx.cs"
   2:      Inherits="Atom.Website.Samples.AtomicButton.ServerSideEvents" %>
   3:   
   4:  <%@ Register Src="../Source.ascx" TagName="Source" TagPrefix="sample" %>
   5:  <%@ Register Assembly="Atom.Web" Namespace="Atom.Web.UI.WebControls" TagPrefix="atom" %>
   6:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   7:  <html xmlns="http://www.w3.org/1999/xhtml">
   8:  <head id="Header1" runat="server">
   9:      <link rel="Shortcut Icon" type="image/ico" href="../images/icon.png" /> 
  10:      <!-- The jQuery UI theme that will be used by the components. -->
  11:      <link href="../themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
  12:      <!-- jQuery runtime minified -->
  13:      <script src="../Scripts/jquery-1.9.1.js" type="text/javascript"></script>
  14:      <!-- jQuery UI runtime minified, client-side javascript of the components.-->
  15:      <script src="../Scripts/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
  16:      <!-- This style reference is needed only for the current example. -->
  17:      <link href="../css/example.css" rel="stylesheet" type="text/css" />
  18:      <script type="text/javascript">
  19:          function ClearLogContainer() {
  20:              $("#<%= LogContainer.ClientID %>").val('');
  21:          }
  22:      </script>
  23:  </head>
  24:  <body>
  25:      <form id="form1" runat="server">
  26:      <div>
  27:          <atom:AtomicButton ID="AtomicButton1" runat="server"  Text="AtomicButton"
  28:              OnClick="AtomicButton1_Click" />
  29:      </div>
  30:      <br />
  31:      <fieldset>
  32:          <legend>Events:</legend><a href="javascript:void(0);" style="float: right;" onclick="ClearLogContainer()">
  33:              clear log container</a>
  34:          <asp:TextBox ID="LogContainer" runat="server" TextMode="MultiLine" Width="100%" Text=""
  35:              Height="150px"></asp:TextBox>
  36:      </fieldset>
  37:      <br />
  38:      <sample:Source ID="Code" runat="server" />
  39:      </form>
  40:  </body>
  41:  </html>
   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Web;
   5:  using System.Web.UI;
   6:  using System.Web.UI.WebControls;
   7:   
   8:  namespace Atom.Website.Samples.AtomicButton
   9:  {
  10:      public partial class ServerSideEvents : System.Web.UI.Page
  11:      {
  12:          protected void Page_Load(object sender, EventArgs e)
  13:          {
  14:   
  15:          }
  16:   
  17:          protected void AtomicButton1_Click(object sender, EventArgs e)
  18:          {
  19:              if (ViewState["Count"] == null)
  20:              {
  21:                  ViewState["Count"] = 1;
  22:                  AtomicButton1.Text = "AtomicButton 1 click";
  23:              }
  24:              else
  25:              {
  26:                  ViewState["Count"] = (Convert.ToInt32(ViewState["Count"]) + 1);
  27:                  AtomicButton1.Text = "AtomicButton " + ViewState["Count"].ToString() + " clicks";
  28:              }
  29:   
  30:              LogContainer.Text += string.Format("Click at {0}\n", DateTime.Now.ToString("HH:mm:ss"));
  31:          }
  32:      }
  33:  }
   1:  Imports System
   2:  Imports System.Collections.Generic
   3:  Imports System.Linq
   4:  Imports System.Web
   5:  Imports System.Web.UI
   6:  Imports System.Web.UI.WebControls
   7:  Namespace Atom.Website.Samples.AtomicButton
   8:      Public Partial Class ServerSideEvents
   9:          Inherits System.Web.UI.Page
  10:          Protected Sub Page_Load(sender As Object, e As EventArgs)
  11:          End Sub
  12:          Protected Sub AtomicButton1_Click(sender As Object, e As EventArgs)
  13:              If ViewState("Count") = Nothing Then
  14:                  ViewState("Count") = 1
  15:                  AtomicButton1.Text = "AtomicButton 1 click"
  16:              Else
  17:                  ViewState("Count") = (Convert.ToInt32(ViewState("Count")) + 1)
  18:                  AtomicButton1.Text = "AtomicButton " + ViewState("Count").ToString() + " clicks"
  19:              End If
  20:              LogContainer.Text += String.Format("Click at {0}" & vbLf, DateTime.Now.ToString("HH:mm:ss"))
  21:          End Sub
  22:      End Class
  23:  End Namespace