auto reload of a page

F

francois

I have an aspx page that needs to reload itself every x seconds. X is a
parameter retrieve from the DB or the web.config file, just to point out
that it will not be hardcoded.

I need to refresh the page as the information displayed on that page is
highly dynamic and need to be refresed very often.

Now I would like to know the best way to achieve this.

I have heard of using the <meta http-equi='refresh'> or then maybe use
javascrip.

But is there nto anything build in the ASP.NET framework?

Best regards,

Francois
 
H

Hans Kesting

francois said:
I have an aspx page that needs to reload itself every x seconds. X is a
parameter retrieve from the DB or the web.config file, just to point out
that it will not be hardcoded.

I need to refresh the page as the information displayed on that page is
highly dynamic and need to be refresed very often.

Now I would like to know the best way to achieve this.

I have heard of using the <meta http-equi='refresh'> or then maybe use
javascrip.

But is there nto anything build in the ASP.NET framework?

Best regards,

Francois

not exactly built-in, but you could also use
Response.AddHeader("Refresh", refreshrate.ToString());

(where "refreshrate" is the refreshrate in seconds)

this is the "original version" of <meta http-equiv="refresh"
content="refreshrate">

Hans Kesting
 
R

Ryan Walberg

francois said:
I have an aspx page that needs to reload itself every x seconds. X is a
parameter retrieve from the DB or the web.config file, just to point out
that it will not be hardcoded.

I need to refresh the page as the information displayed on that page is
highly dynamic and need to be refresed very often.

Now I would like to know the best way to achieve this.

I have heard of using the <meta http-equi='refresh'> or then maybe use
javascrip.

But is there nto anything build in the ASP.NET framework?

The best way to do this is to use JavaScript.

<head>
<script language="JavaScript">
function startTimer() {
setInterval(onTick,1000); // every second
}
function onTick() {
document.location.reload();
}
</script>
</head>
....
<body onLoad="startTimer();">
...
</body>
 
T

Tommy

I don't think ASP.NET has build feature that can do this.

I think one way is to put the data that needs to refresh frequently
into an IFrame, and make the page in the IFrame refresh at a regular
interval. This way you won't have to reload the entire page, but only
the data you need.

A more advance approach will be to have a hidden frame that constantly
poll data from the server, and only update the page when new data
arrives.

Both approach will require a lot more coding than simply refreshing
the entire page, so they might not be an option if it doesn't fit your
budget.

Tommy,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top