Client Callbacks using a Gridview

  • Thread starter Thread starter yobofunk
  • Start date Start date
Y

yobofunk

On my page, I have a gridview that must update every 5 seconds. To
implement this, I use the client callback feature.

On the server-side, I have a function which takes the GridView object
on the page and calls the DataBind() method on it. Thereafter, I take
that GridView object and return it's HTML-equivalent to the client.

On the client-side, i have a procedure which loops every 5 seconds.
When it hears back from the server, it takes the HTML-equivalent of the
Gridview and makes the replacement necessary.

I really like this approach as it looks great (i.e. no blinking as
there is no "refresh" going on)

Anyhow, the problem I am facing is performance. Changing my refresh
rate is no allowed (customer has made it mandatory that it refreshes
every 5 seconds). What I figure would work is to check my
gridview/datasource object to see if it has changed - if yes, then
return the Gridview's HTML, else, return -1 and on the client side,
change the code where appropriate.

So I guess the real problem is - how do I detect whether or not a
Gridview/datasource has changed ? Note that my datasource is based on
a stored procedure across multiple tables.

Thanks in advance
Ed
 
Hi Ed,

What I can suggest to you is to write a cookie whenever you do databinding.
Once you have done the databinding, write a cookie value with the current
date/time. When your client post back occurs, check that date time up with
the data source and see if anything has changed since then. If so, then
rebind. If not, send an empty string back to the client where your
JavaScript will know that an empty string means no change.

Regards,
Justin.
 
Hi Ed,

I'm having a situation where I have to update my GridView in every 30
secs without any postback. I tried with Client Callback and no hope.
Now, I read that you had successfully implemented the GridView update
without any postback (using Client Callback). So if you don't mind,
could you share your code snippet for the same or explain me a little
more how you achieved it ?

Thanks in advance..Bijo
 
Back
Top