Click here to Skip to main content
15,063,944 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a code like below,

XML
<html>
<head>
<meta http-equiv="refresh" content="1" >
<title>Runtime Status Report</title>
</head>
<body>


Hence it is always refreshing the page. Hence it's not good.
I need a button to enable and disable the auto referesh
Posted

You may use Timer control to auto refresh your page.
On button click disable the timer control if its enabled and vice versa.
In this way, you can enable/disable auto refresh of the page.
   
Response.AddHeader
Here is a another way of what you want. Auto refreshing it, .

Place a button to enable this 'Auto refresh'. Put this code ther:
C#
Response.AddHeader("Refresh", Convert.ToString("some time after which you need refresh");


Place another button to disable this. Remove this Header.
C#
Response.AppendHeader("Refresh", Convert.ToString("some very large time will work like no refresh");


You are done!
   

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900