Click here to Skip to main content
11,721,289 members (80,200 online)
Rate this: bad
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
Please Sign up or sign in to vote.

Solution 2

you can use timer class and set tick property to 5000
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
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[^]
<meta http-equiv="Refresh" content="10;URL="></meta>

You can append meta tag from code behind too:
Response.AppendHeader("Refresh", "10; URL=")

Method #2:
Using Timer Control[^]: It allow you to do postbacks at certain intervals: Timer control[^]:
<asp:Timer runat="server" id="UpdateTimer" interval="5000" ontick="UpdateTimer_Tick" />
<asp:UpdatePanel runat="server" id="TimedPanel" updatemode="Conditional">
        <asp:AsyncPostBackTrigger controlid="UpdateTimer" eventname="Tick" />
        <asp:Label runat="server" id="DateStampLabel" />

Method #3:
Using setTimeout in Javascript: Automatically refresh page after some interval[^]
function RefreshPage(Period)
    setTimeout("location.reload(true);", Period);
<body  önload="javaScript:RefreshPage(1000);">

Method #4:
Using Response.AppendHeader method: MSDN: HttpResponse.AppendHeader Method[^]
// 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.

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