Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to page auto refresh in asp net after timeout.

I need to auto refresh my webpage after 3 min. any one can help me.After page refresh i want
automatically bind a data in my gridview.

Thank you.
Posted
Updated 2-Dec-13 18:49pm
v2

Why are reloading entire page?

Instead try to reload the gridview. You could use AJAX or jQuery. Check these

Put your GridView inside UpdatePanel. And use Timer for Refresh.
Timer Control Overview[^]
Tutorial: How to refresh an UpdatePanel control at a timed interval[^]

Here jQuery sample
Refresh a div at every 10 seconds[^]
 
Share this answer
 
Add this tag under header section in your master page

HTML
<meta http-equiv='refresh' content='9000;url='yourpage.aspx' />


content refers the time in seconds.

url, the page which u needs to be refreshed in certain time interval
 
Share this answer
 
<meta http-equiv='refresh' content='5000' />
//Mention required milli seconds in content,which refresh your current page at the given interval of ms.

Other way to do that is:
C#
setTimeout(function() {
 location.reload();// load your page after every 5 seconds
}, 5000);


5000 is in milliseconds you can mention the time as per your requirement..
 
Share this answer
 
v3
 
Share this answer
 
For page refresh

C#
<meta http-equiv="refresh" content="120">


And for grid bind write a function to bind grid say bindGrid().

use this code to call this function on pageload.

C#
protected void Page_Load(object sender, EventArgs e)
   {
       if(!IsPostBack)
       {
           bindGrid();
       }
   }


Best of luck.
 
Share this answer
 

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