Click here to Skip to main content
15,881,600 members
Articles / Web Development / ASP.NET

DHTML timer control

Rate me:
Please Sign up or sign in to vote.
4.64/5 (17 votes)
13 Oct 20056 min read 97.7K   2.5K   50  
How to implement a reusable DHTML timer.
  • timer_control.zip
    • AssemblyInfo.cs
    • bin
      • Release
        • Cronometro.dll
    • Cronometro.cs
    • Cronometro.csproj
    • Cronometro.csproj.user
    • cronometro.ico
    • Cronometro.sln
    • CronometroDesigner.cs
    • DesignTimeImageHandler.cs
    • EstiloCronometro.cs
    • EstiloCronometroConverter.cs
    • EstiloCronometroEditor.cs
    • EstiloCronometroEditorControl.cs
    • EstiloCronometroEditorControl.resx
    • images
      • blue0.GIF
      • blue1.gif
      • blue2.gif
      • blue3.gif
      • blue4.gif
      • blue5.gif
      • blue6.gif
      • blue7.gif
      • blue8.gif
      • blue9.gif
      • bluey0.gif
      • bluey1.gif
      • bluey2.gif
      • bluey3.gif
      • bluey4.gif
      • bluey5.gif
      • bluey6.gif
      • bluey7.gif
      • bluey8.gif
      • bluey9.gif
      • BRUSH.GIF
      • brush0.gif
      • brush1.gif
      • brush2.gif
      • brush3.gif
      • brush4.gif
      • brush5.gif
      • brush6.gif
      • brush7.gif
      • brush8.gif
      • brush9.gif
      • chevy0.GIF
      • chevy1.gif
      • chevy2.gif
      • chevy3.gif
      • chevy4.GIF
      • chevy5.gif
      • chevy6.GIF
      • chevy7.GIF
      • chevy8.gif
      • chevy9.gif
      • chin0.GIF
      • chin1.gif
      • chin2.gif
      • chin3.gif
      • chin4.gif
      • chin5.gif
      • chin6.gif
      • chin7.gif
      • chin8.gif
      • chin9.gif
      • chinred0.gif
      • chinred1.gif
      • chinred2.gif
      • chinred3.gif
      • chinred4.gif
      • chinred5.gif
      • chinred6.gif
      • chinred7.gif
      • chinred8.gif
      • chinred9.gif
      • cntdwn0.gif
      • cntdwn1.gif
      • cntdwn2.gif
      • cntdwn3.gif
      • cntdwn4.gif
      • cntdwn5.gif
      • cntdwn6.gif
      • cntdwn7.gif
      • cntdwn8.gif
      • cntdwn9.gif
      • comp0.gif
      • comp1.gif
      • comp2.gif
      • comp3.gif
      • comp4.gif
      • comp5.gif
      • comp6.gif
      • comp7.gif
      • comp8.gif
      • comp9.gif
      • crt0.gif
      • crt1.gif
      • crt2.gif
      • crt3.gif
      • crt4.gif
      • crt5.gif
      • crt6.gif
      • crt7.gif
      • crt8.gif
      • crt9.gif
      • emb0.gif
      • emb1.gif
      • emb2.gif
      • emb3.gif
      • emb4.gif
      • emb5.gif
      • emb6.gif
      • emb7.gif
      • emb8.gif
      • emb9.gif
      • fancyb0.gif
      • fancyb1.gif
      • fancyb2.gif
      • fancyb3.gif
      • fancyb4.gif
      • fancyb5.gif
      • fancyb6.gif
      • fancyb7.gif
      • fancyb8.gif
      • fancyb9.gif
      • glow0.gif
      • glow1.gif
      • glow2.gif
      • glow3.gif
      • glow4.gif
      • glow5.gif
      • glow6.gif
      • glow7.gif
      • glow8.gif
      • glow9.gif
      • grvy0.GIF
      • grvy1.gif
      • grvy2.gif
      • grvy3.gif
      • grvy4.gif
      • grvy5.gif
      • grvy6.gif
      • grvy7.gif
      • grvy8.gif
      • grvy9.gif
      • marine0.gif
      • marine1.gif
      • marine2.gif
      • marine3.gif
      • marine4.gif
      • marine5.gif
      • marine6.gif
      • marine7.gif
      • marine8.gif
      • marine9.gif
      • odo0.gif
      • odo1.gif
      • odo2.gif
      • odo3.gif
      • odo4.gif
      • odo5.gif
      • odo6.gif
      • odo7.gif
      • odo8.gif
      • odo9.gif
      • white0.GIF
      • white1.gif
      • white2.gif
      • white3.GIF
      • white4.gif
      • white5.GIF
      • white6.GIF
      • white7.GIF
      • white8.GIF
      • white9.GIF
    • scripts
  • timertest.zip
    • AssemblyInfo.cs
    • cronometro.dll
    • TimerTest.dll
    • Global.asax
    • Global.asax.cs
    • Global.asax.resx
    • blue0.GIF
    • blue1.gif
    • blue2.gif
    • blue3.gif
    • blue4.gif
    • blue5.gif
    • blue6.gif
    • blue7.gif
    • blue8.gif
    • blue9.gif
    • bluey0.gif
    • bluey1.gif
    • bluey2.gif
    • bluey3.gif
    • bluey4.gif
    • bluey5.gif
    • bluey6.gif
    • bluey7.gif
    • bluey8.gif
    • bluey9.gif
    • BRUSH.GIF
    • brush0.gif
    • brush1.gif
    • brush2.gif
    • brush3.gif
    • brush4.gif
    • brush5.gif
    • brush6.gif
    • brush7.gif
    • brush8.gif
    • brush9.gif
    • chevy0.GIF
    • chevy1.gif
    • chevy2.gif
    • chevy3.gif
    • chevy4.GIF
    • chevy5.gif
    • chevy6.GIF
    • chevy7.GIF
    • chevy8.gif
    • chevy9.gif
    • chin0.GIF
    • chin1.gif
    • chin2.gif
    • chin3.gif
    • chin4.gif
    • chin5.gif
    • chin6.gif
    • chin7.gif
    • chin8.gif
    • chin9.gif
    • chinred0.gif
    • chinred1.gif
    • chinred2.gif
    • chinred3.gif
    • chinred4.gif
    • chinred5.gif
    • chinred6.gif
    • chinred7.gif
    • chinred8.gif
    • chinred9.gif
    • cntdwn0.gif
    • cntdwn1.gif
    • cntdwn2.gif
    • cntdwn3.gif
    • cntdwn4.gif
    • cntdwn5.gif
    • cntdwn6.gif
    • cntdwn7.gif
    • cntdwn8.gif
    • cntdwn9.gif
    • comp0.gif
    • comp1.gif
    • comp2.gif
    • comp3.gif
    • comp4.gif
    • comp5.gif
    • comp6.gif
    • comp7.gif
    • comp8.gif
    • comp9.gif
    • crt0.gif
    • crt1.gif
    • crt2.gif
    • crt3.gif
    • crt4.gif
    • crt5.gif
    • crt6.gif
    • crt7.gif
    • crt8.gif
    • crt9.gif
    • emb0.gif
    • emb1.gif
    • emb2.gif
    • emb3.gif
    • emb4.gif
    • emb5.gif
    • emb6.gif
    • emb7.gif
    • emb8.gif
    • emb9.gif
    • fancyb0.gif
    • fancyb1.gif
    • fancyb2.gif
    • fancyb3.gif
    • fancyb4.gif
    • fancyb5.gif
    • fancyb6.gif
    • fancyb7.gif
    • fancyb8.gif
    • fancyb9.gif
    • glow0.gif
    • glow1.gif
    • glow2.gif
    • glow3.gif
    • glow4.gif
    • glow5.gif
    • glow6.gif
    • glow7.gif
    • glow8.gif
    • glow9.gif
    • grvy0.GIF
    • grvy1.gif
    • grvy2.gif
    • grvy3.gif
    • grvy4.gif
    • grvy5.gif
    • grvy6.gif
    • grvy7.gif
    • grvy8.gif
    • grvy9.gif
    • marine0.gif
    • marine1.gif
    • marine2.gif
    • marine3.gif
    • marine4.gif
    • marine5.gif
    • marine6.gif
    • marine7.gif
    • marine8.gif
    • marine9.gif
    • odo0.gif
    • odo1.gif
    • odo2.gif
    • odo3.gif
    • odo4.gif
    • odo5.gif
    • odo6.gif
    • odo7.gif
    • odo8.gif
    • odo9.gif
    • white0.GIF
    • white1.gif
    • white2.gif
    • white3.GIF
    • white4.gif
    • white5.GIF
    • white6.GIF
    • white7.GIF
    • white8.GIF
    • white9.GIF
    • crono.js
    • Test.aspx
    • Test.aspx.cs
    • Test.aspx.resx
    • TimerTest.csproj
    • TimerTest.csproj.webinfo
    • Web.config
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace TimerTest
{
	/// <summary>
	/// Summary description for WebForm1.
	/// </summary>
	public class WebForm1 : System.Web.UI.Page
	{
		protected Flanders.Componentes.Cronometro Cronometro2;
		protected Flanders.Componentes.Cronometro Cronometro3;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.Label Label2;
		protected Flanders.Componentes.Cronometro Cronometro4;
		protected Flanders.Componentes.Cronometro Cronometro1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			Cronometro1.ScriptPath = "~/scripts/";
			Cronometro1.ImagesPath = "~/images/";
			Cronometro1.Duracion = new TimeSpan(0, 1, 0);
			Cronometro1.Ascendente = false;

			Cronometro2.ScriptPath = "~/scripts/";
			Cronometro2.ImagesPath = "~/images/";
			Cronometro2.Duracion = new TimeSpan(0, 1, 10);
			Cronometro2.Ascendente = false;
			Cronometro2.CausaPostBack = false;

			Cronometro3.ScriptPath = "~/scripts/";
			Cronometro3.ImagesPath = "~/images/";
			Cronometro3.Duracion = new TimeSpan(0, 1, 20);
			Cronometro3.Ascendente = false;
			Cronometro3.CausaPostBack = false;

			Cronometro4.ScriptPath = "~/scripts/";
			Cronometro4.ImagesPath = "~/images/";
			Cronometro4.Duracion = new TimeSpan(0, 1, 30);
			Cronometro4.Ascendente = true;
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Cronometro1.TimeOut += new System.EventHandler(this.Cronometro1_TimeOut);
			this.Cronometro4.TimeOut += new System.EventHandler(this.Cronometro4_TimeOut);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Cronometro1_TimeOut(object sender, System.EventArgs e)
		{
			Label1.Visible = true;
		}

		private void Cronometro4_TimeOut(object sender, System.EventArgs e)
		{
			Label2.Visible = true;
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Spain Spain
Manuel Abadia had his MS Degree in Computer Science (Univ. Murcia, Spain)

He is a Freelance Software Architect/Engineer and Trainer.

He sells his own components in his webpage (http://www.manuelabadia.com).

He was the Software Architect for the MoviTAP project that won the first prize in the Microsoft and Vodafone mobile web Services contest.

He has done some external work in companies like Namco America Inc. and Gaelco SA.

He has contributed to the MAME project (http://www.mamedev.com) for some years (and continues to do so eventually).

Comments and Discussions