开发者

ASP.NET AJAX w/ Adjustable Timer

I have a quick and simple implementation: a ListView inside an updatepanel. To make the panel autorefresh, I added a timer:

And then added the trigger to the panel:

开发者_运维问答

This works just fine. What I'd like to do is have a dropdown with a few values (None, 5, 10, 15, 30 seconds) so the user can adjust how frequently the timer fires. Also, it kind of implicitly lets the user know the page refreshes.

I was wondering if there was an easy way do this? I was thinking I could add a select box/dropdown with those values, fire an event when it changes, and update the Timer's interval via javascript. Not too sure if that's feasible.

Alternatively, I could do it serverside, but I think client side is a bit cleaner. Thoughts?


According to this blog post http://devarchive.net/client-side-timer-control-asp-net-ajax.aspx it is possible to set the tick interval clientside. A few weeks back I tried to tap into another event handler mentioned in this post, add_tick but wasn't successful. My issue may have been with the version of ASP.NET ajax I was using. Either way give it a try and if it works for you then good times.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜