Click here to Skip to main content
11,721,289 members (80,200 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Javascript Ajax jQuery , +
i'm having a scenario to call load event after every 5 seconds or 10 seconds some one help me.
Posted 19-Jul-12 21:29pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

you can use timer class and set tick property to 5000
  Permalink  
Comments
deepgalley at 20-Jul-12 12:11pm
   
No i wan't it in jquery or in ajax.
deepgalley at 20-Jul-12 12:11pm
   
it should be asynchronous operation
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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:
// Page refresh is set to 5 seconds after the client session timeout setting specified in the web.config file.
this.Response.AppendHeader("Refresh",Convert.ToString(Session.Timeout * 60 + 5));

Pick one that suits you.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 510
1 OriginalGriff 249
2 Mika Wendelius 170
3 F-ES Sitecore 80
4 cyycoish 70
0 Sergey Alexandrovich Kryukov 2,209
1 OriginalGriff 969
2 F-ES Sitecore 660
3 Maciej Los 609
4 Richard MacCutchan 560


Advertise | Privacy | Mobile
Web04 | 2.8.150901.1 | Last Updated 20 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100