How to write script to page reload in ASP
How one can write an script to reload the page in ASP.Net, for more details, i wanted to format the page where i want to provide the Button which should Reload the page this will help the user to not to go anywhere on the Browser they would get the button on their existing page.
Re: How to write script to page reload in ASP
You need to use the following methods to reload and refresh the page, YOu could have the same page be separated. one loads the blank html form. when it submits have it submit to itself. and detect for data in some fields or a variable. DataBind the other control on the OnButtonClick event for the update button.
function doLoad()
{
// make sure to timeout value should be the same as in the "refresh" meta-tag
setTimeout( "refresh()", 3*1500 );
}
function refresh()
{
// This version of the refresh function will cause a new
// entry in the visitor's history. It is provided for
// those browsers that only support JavaScript 1.0.
//
window.location.href = sURL;
}
Re: How to write script to page reload in ASP
One way to handle this could be using Bubble events. You can create a bubble event and call it from within each user control tab to rebind that data. If you use Response.Redirect() there is an options to end response by setting a boolean value. You might want to take a look at this.
<body onload="timer=setTimeout('move()',2000)">
In the above example of JavaScript that will reload a page in 3 seconds. See timer=setTimeout('move()',2000) 2000 will be the counter number of milliseconds which equals to 2 seconds. after it gets complete the page will be refreshed.
Re: How to write script to page reload in ASP
I think you are making it a bit to complicated for yourself and i presume you don't need to reload every page that uses the header.asp include. You need to simply add a metarefesh tag to execute the code if the variable matches first load, else just display the page. It defines multiple JavaScript code blocks, where each JavaScript version block redefines the same function.