Click here to Skip to main content
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 Dnyaneshwar@Pune 604
1 thatraja 380
2 OriginalGriff 236
3 Gihan Liyanage 210
4 kbrandwijk 204
0 OriginalGriff 737
1 Dnyaneshwar@Pune 604
2 Kornfeld Eliyahu Peter 505
3 Sergey Alexandrovich Kryukov 405
4 thatraja 370


Advertise | Privacy | Mobile
Web01 | 2.8.140902.1 | Last Updated 20 Jul 2012
Copyright © CodeProject, 1999-2014
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