Hi,
Could any one help how to auto refresh particular content page only in a master page ?
Thank you in advance.
Regard
Saravanan.S
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Suthish NairRank #92 · 22.8K reputationPosted Apr 7, 2011, 11:44 AM EDT
Andrew FensterRank #983 · 2K reputationPosted Apr 7, 2011, 12:26 PM EDT
I would create an interface, IAutoRefresh. Your individual pages that are going to update would implement IAutoRefresh. When the timer posts back to the Master Page, the Master Page would update itself, and then it would do something like this to make the specific page update itself.
if (Page is IAutoRefresh)
{
IAutoRefresh currentPage = (IAutoRefresh)Page;
currentPage.Refresh();
}
If you don't want a particular page to auto refresh, you would not have it implement IAutoRefresh.
saravanan subramanian15 reputationPosted Apr 8, 2011, 1:11 AM EDT
Thank you in advance.
Regard
Saravanan.s
piyush sardhara177 reputationPosted Apr 8, 2011, 1:26 AM EDT
piyush sardhara177 reputationPosted Apr 8, 2011, 1:28 AM EDT
"text/javascript" language="javascript"> var reloadTimer = null; var sURL = unescape(window.location.pathname); function setReloadTime(secs) { //this function is used to refresh the broswer if (arguments.length == 1) { //if some seconds are passed in then create and set the timer and //have it call this function again with no seconds passed in if (reloadTimer) clearTimeout(reloadTimer); reloadTimer = setTimeout("setReloadTime()", Math.ceil(parseFloat(secs) * 1000)); } else { //No seconds were passed in the timer must be up clear the timer //and refresh the browser reloadTimer = null; //passing true causes the request to go back to the web server // false refreshs the page from history //This is javascript 1.2 location.reload(true); //This is javascript 1.1 window.location.replace( sURL ); } } script>saravanan subramanian15 reputationPosted Apr 8, 2011, 2:19 AM EDT
Do you know any idea about "Response.Addheader" concept ?
piyush sardhara177 reputationPosted Apr 8, 2011, 2:32 AM EDT
saravanan subramanian15 reputationPosted Apr 8, 2011, 2:48 AM EDT
is this correct ? if correct where we have to use this code whether master page or content page ?
Thank you in advance.
Regard
saravanan.s
Karthikeyan AnbarasanRank #71 · 25.5K reputationPosted Apr 8, 2011, 2:54 AM EDT
Andrew FensterRank #983 · 2K reputationPosted Apr 8, 2011, 4:03 AM EDT
Your page's OnLoad( ) function would fire as if it were not a postback. The selections the user has made in text boxes and drop downs would be gone and the page would be reset.
If you want better control over what happens when the page refreshes, you need to write a custom Refresh( ) method (or whatever you want to call it) for each page. Then you need to call this method somehow. You could do it the way I suggested earlier, or you could do it with an Ajax call or some other way.
There is a drag and drop timer control you can put on your page. You set its properties to say how often if fires. Then you add an event handler to catch the timer event. It's easy, no more complicated than handling any other event like a button click.
fawzan mohamed65 reputationPosted Apr 21, 2011, 8:22 PM EDT
Ankit NandekarRank #703 · 3.4K reputationPosted Apr 21, 2011, 8:58 PM EDT
Here 10 is the amount of time, in seconds, until the browser should reload the current page.
Suthish NairRank #92 · 22.8K reputationPosted Apr 21, 2011, 10:11 PM EDT