There are various ways to refresh page automatically after certain interval of time.
Method #1:
Using
META tag
in head section:
Meta Refresh Tag[
^]
Sample:
<meta http-equiv="Refresh" content="10;URL=http://www.yourURL.com"></meta>
You can append meta tag from code behind too:
Response.AppendHeader("Refresh", "10; URL=http://www.yourURL.com")
Method #2:
Using
Timer Control[
^]: It allow you to do postbacks at certain intervals:
Timer control[
^]:
Sample;
<asp:Timer runat="server" id="UpdateTimer" interval="5000" ontick="UpdateTimer_Tick" />
<asp:UpdatePanel runat="server" id="TimedPanel" updatemode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger controlid="UpdateTimer" eventname="Tick" />
</Triggers>
<ContentTemplate>
<asp:Label runat="server" id="DateStampLabel" />
</ContentTemplate>
</asp:UpdatePanel>
Method #3:
Using
setTimeout
in Javascript:
Automatically refresh page after some interval[
^]
Sample:
function RefreshPage(Period)
{
setTimeout("location.reload(true);", Period);
}
<body önload="javaScript:RefreshPage(1000);">
Method #4:
Using
Response.AppendHeader
method:
MSDN: HttpResponse.AppendHeader Method[
^]
Sample:
this.Response.AppendHeader("Refresh",Convert.ToString(Session.Timeout * 60 + 5));
Pick one that suits you.