In web application environment we lack a proper timer control just like we have in windows application development environment. This is one of the main reasons why I went in search of a web based timer control. I tried a lotz of search in net to find a suitable web based timer control code or for an idea which we can use in web application and can be controlled from the code behind, and i ended up in codeproject. I got an article by TCDooM where he posted one of his creations i.e. a custom timer control which we can use in web apps. Thanx TCDooM :)
His article and his work really helped me to complete this control. The base of my control is the contribution of TCDooM's work.
This control is pretty easy to use and you can make use of it with the help of a few properties. Just add the files into your page and then drag and drop to any page and call the timer object.
I am not going to explain the code because the code is that much simple and straight forward that any newbie in ASP.Net can understand.
So let me give an overview
- First use the namespace DControls
- This web timer has mainly two functions.
a. WebTimer1.SetTimerAction = Timer.TimerAction.Postback_Page;
b. WebTimer1.SetTimerAction = Timer.TimerAction.Execute_JSFunction;
i. WebTimer1.SetJSFunctionName = "ClientJSFunction()";
3. Timer will be disabled by default.
4. Intervals you can specify in minutes or seconds or milliseconds. Minute is default. Then set the interval duration.
WebTimer1.Interval = 30;
WebTimer1.SetIntervalMode = Timer.IntervalMode.Seconds;
If you set the timer action as Postback_Page then in the code behind you have to use a property called IsPostedBackByTimer which will tell you whether the page is posted back by timer or by any other events.
Response.Write("Page Posted Back By WebTimer");
Currently I used C# but anybody can easily convert into vb.net.
Don't hesitate to contact me if you need any help or if you have any suggestions or comments
so..... happy programming ;)