Moses on DotNetSlackers

.Net Gorean Lifestyler

This site

News

@ Cambridge, UK

Blogs

Sponsors

  • MaximumASP
  • Packet Sniffer
    Custom Essay
  • optimum rewards

March 2007 - Posts

ASP.NET 2.0 AJAX Timer Hacks! How to Pause ASP.NET AJAX Timer.

from about 2 weeks I wrote an article about how you can use ASP.NET 2.0 AJAX Timer control in a real world scenario side by side with RssToolKit.

The idea it to display RSS feed from deferent location in cycle using ASP.NET AJAX Timer. I also had an idea of pausing the Timer when the user move his mouse over the update-able area "Group Box that display feeds inside it". Of course this should be down from client side.

I searched the documentation for Client Side APIs related to the AJAX Timer control but I didn't find any. I had to hack inside AJAX Timer client library downloaded with ASP.NET AJAX Extensions, and I found what I want.

First I though that by setting client side enabled property using set_enabled(false) of the AJAX Timer I could get what I want; actually I was wrong, this will not pause the Timer.

Dig deeper, but not for too long, I found 2 methods  _startTimer() and _stopTimer(), those were excatly what I was looking for.

bellow is a sample client code of how you can use these 2 methods:

function startTimer()
{
     
var timer = $find("<%=ajaxTimer.ClientID%>")
      timer._startTimer();
}

function stopTimer()
{
     
var timer = $find("<%=ajaxTimer.ClientID%>")
      timer._stopTimer();
}

The above code assuming that you have an AJAX Timer control on the page named ajaxTimer.
Call these method from your client side code, or add them as event handlers on your target elements.

I don't know why these are not documented, or we are not supposed to use them?! Actually I don't know.
I thought that after using these methods the browser will cause a problem regarding client scripts, but both Opera and IE worked just fine without any problem. Also I didn't notice any slow down or hanging in both browsers.

Hope you find it useful.

My first Wiki experiance, My first Wiki contribution

Well, recently I've joind CSharp-Online community. It is Wiki Media based community web site. Actually this is the first time to use Wiki. I was always watching Wikies but never touch them.

I liked that Wiki. It is easy and smart or may be I'm a dump.

Anyway, I've finalized my first contribution on there and it is about Creating Custom ASP.NET AJAX Client Controls.

I've built this article on top of this tutorial "Adding Client Capability to a Web Server Control Using ASP.NET AJAX Extensions".

Hope it will be useful for someone.

The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.