Hi,

you can do something like a periodical updater:

<div id="myid"></div>

<script type="text/javascript">

var periodicalUpdater = Class.create();

Object.extend(periodicalUpdater.prototype, {
    callback: function(res) {
        if(res.value != null) {
            this.ele.innerHTML = res.value;
        }
        setTimeout(this.update.bind(this), this.interval);
    },
    update: function() {
        MyNamespace.MyClass.MyMethod(this.callback.bind(this));
    },
    initialize: function(id, interval) {
        this.ele = $(id);
        this.interval = (interval != null ? interval : 1000);
        setTimeout(this.update.bind(this), this.interval);
    }
}, false);

var x = new periodicalUpdater("myid", 2000);

</script>


The example above will update the myid DIV every 2000 msec. The next
step would be to change the class to add an argument for the
constructor that will hold the AjaxMethod name, then you can use this
for any method. Or add a new property that will stop the automatic
refresh, then you can call "x.update()" manual.

I hope this example will help you...!

Regards,
Michael










On 5/19/06, Wasim <[EMAIL PROTECTED]> wrote:
>
> Hi I would like to know how i can get a single value from the database
> using the callback function more like datareader.executescalar();
> This value needs to be updated constantly.
>
> Thanx
>
>
> >
>


-- 
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---

Reply via email to