• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 580
  • Last Modified:

How to auto Refresh my page if any events are not done for a certain time (Period)?

Hi,
 How to auto Refresh my page if any events are not done for a certain time (Period)? I can use Meta tag but the disadvantage is after certain time it will refresh the page, in the refreshing time if some body doing any operation then that data will loose. So pleas tell me another senario for this one.

Thanks
0
PillalamarriVenkateswaraRao
Asked:
PillalamarriVenkateswaraRao
  • 3
1 Solution
 
varungdCommented:
Place a linkbutton in the form and write the codes  in the click event of that linkbutton,  that is what r the functions u need to work if u were using refresh option and use the javascript like

<script > 
window.setTimeout("document.getElementById('LinkButton1').click()", 10000);
</script>
 
0
 
PillalamarriVenkateswaraRaoAuthor Commented:
Sorry I can't get you. My main intension is if a person keeps the page for a certain time (e.g 30 min) then I want to refresh a page. So I want to check the page is idle for that perticular amount of time (e.g 30 min) if it is idea then i will refresh that page.
Thanks
0
 
varungdCommented:
Hi
 I am attaching some codes using asp.net ,c# . U try this ... I think there is no other ways for doing this.

webconfig
 
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="2" />
 
HTML
  <body id ="by" runat="server">
 
 
form Page_load
 
  int timeOut = ((Session.Timeout - 1) * 1000) * 60;
            by.Attributes.Add("onLoad", " window.setTimeout('Redirect();'," + timeOut + ")");
 
javascript
 
<script >
function Redirect()
{
    window.location.href="map.aspx";
}
</script>

Open in new window

0
 
varungdCommented:

webconfig
 
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="31" />
 
HTML
  <body id ="by" runat="server">
 
 
form Page_load
 
  int timeOut = ((Session.Timeout - 1) * 1000) * 60;
            by.Attributes.Add("onLoad", " window.setTimeout('Redirect();'," + timeOut + ")");
 
javascript
 
<script >
function Redirect()
{
    window.location.href="map.aspx";
}
</script>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now