Hi,
I have an asp.net application with Ajax in which m usign update panel for a grid view for refreshing. I want to show the message on browsing window saying "Refreshign in 30 seconds"( number vary for each second).
Please let me asap.
Thanks Rupa
Hi,
I have an asp.net application with Ajax in which m usign update panel for a grid view for refreshing. I want to show the message on browsing window saying "Refreshign in 30 seconds"( number vary for each second).
Please let me asap.
Thanks Rupa
You can do this on the client in javascript with some good old fashioned DOM manipulation:
var count=30;
var interval=setInterval(function()
{
var tn=document.createTextNode("Refreshing in "+count+"s");
var targetElement=document.getElementById("someElemId");
var replaceText=targetElement.childNodes[0];
if(replaceText!=null)
{
targetElement.replaceChild(tn,replaceText);
}
else
{
targetElement.appendChild(tn);
}
if(count==0)
{
clearInterval(interval);
window.location.reload(true); //or whatever you need to refresh
}
--count;
},1000);
You'll need some sort of element in the DOM with id "someElemId". Of course, setInterval isn't 100% accurate, but should be good enough.