Hello all,

I have a web form with a submission confirmation message that I would like to display for 10 seconds (after the page returns from the "Submit" event) and then hide after the 10 seconds has elapsed.

I decided to use the System.Web.UI.Timer object, set it's interval, enable it, and registered my "Tick" event handler with it.

Problem is that the Tick() event handler is never fired, and I'm not sure why.

I've followed all the examples that I've found on the Net exactly, exept for one thing--they all include a timer.Start() call, which gives me compilation errors when I try to call Start() on my System.Web.UI.timer object. These examples say that they're using System.Web.UI.timer, but that can't be since there is no System.Web.UI.timer Start() method...or is there, and I just missed it?

Can someone clarify?

I understand that there are other timer classes like System.Timers.Timer and System.Threading.Timer which have Start() methods, but I think I need the System.Web.UI timer since it's for a web form.

Thanks!

Recommended Answers

All 2 Replies

System.Timers.Timer and System.Threading.Timer cannot be used to use a time at client browser. They are intended to use in Desktop application or server side code. Also the System.Web.UI.Time does not have a Start() method.

It is sufficient that if you set the Interval property and handle the Tick event in your page. Also you need to use a ScriptManeger in order to function the Time control well.

Thank you. Adding the ScriptManager in the Design Time view worked. I'd been initializing it in code behind prior, which apparently doesn't work.

System.Timers.Timer and System.Threading.Timer cannot be used to use a time at client browser. They are intended to use in Desktop application or server side code. Also the System.Web.UI.Time does not have a Start() method.

It is sufficient that if you set the Interval property and handle the Tick event in your page. Also you need to use a ScriptManeger in order to function the Time control well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.