Microsoft AJAX Timer Sample

   

   code behind page
   
   Partial Public Class _Default
      Inherits System.Web.UI.Page
   
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
         Timer1.Interval = "1000"
      End Sub
   
      Protected Sub ABC(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
         Label1.Text = Now.ToString
      End Sub
   End Class
   

   

   aspx frontpage
   
   
   <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication2._Default" %>
   
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   
   <html xmlns="http://www.w3.org/1999/xhtml" >
   <head id="Head1" runat="server">
   <title>Untitled Page</title>
   </head>
   
   <body>
      <form id="form1" runat="server">
      <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
   
      <div>
   
         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
   
                  <asp:Timer ID="Timer1" runat="server" OnTick="ABC"></asp:Timer>
                  <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
   
            </ContentTemplate>
         </asp:UpdatePanel>
   
      </div>
      </form>
   </body>
   </html>