title: Display current time in ASP.net and have it ticking
body: <p>I have a requirement in my application to show date and time.
  I am using Ajax in my .net application to do this. </p>
  
  <p>Currently I have this code</p>
  
  <pre><code>                    &lt;asp:ScriptManager ID="ScriptManager1" runat="server" /&gt;
                      &lt;asp:Timer ID="UpdateTimer" runat="server" Interval="1000" OnTick="UpdateTimer_Tick" /&gt;
                      &lt;asp:UpdatePanel ID="TimedPanel" runat="server" UpdateMode="Conditional"&gt;
                          &lt;Triggers&gt;
                              &lt;asp:AsyncPostBackTrigger ControlID="UpdateTimer" EventName="Tick" /&gt;
                          &lt;/Triggers&gt;
                          &lt;ContentTemplate&gt;
                              &lt;asp:Label runat="server" ID="DateStampLabel" /&gt;
                          &lt;/ContentTemplate&gt;
                      &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>It is working just fine besides a one second delay when you refresh the page. My question is this, is this the best way to accomplish this? I could perhaps get away with not showing seconds...that may not be too important. If I do that how should I do it?</p>
  
  <p>Here is the codebehind...</p>
  
  <pre><code>Protected Sub UpdateTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs)
      DateStampLabel.Text = DateTime.Now.ToString()
  End Sub
  </code></pre>
  
  <p>Thanks!</p>