Forum Moderators: open

Message Too Old, No Replies

refreshing web forms

         

cmaryus

12:06 pm on May 7, 2003 (gmt 0)

10+ Year Member



Hi

I implemented a web form that displays a table (System.Web.UI.WebControls.Table) in which i must change the color of the rows at some time interval depending on the data from the cells. The data is read from an Oracle database. The table is displayed ok but i don't know how to generate a page refresh from the code. So far i set a timer function and i want that each time the timer elapsed to refresh the page.

I know that i could do that by java script, but i'm curios what choices i have from C# . I tried using Response.Redirect but it's not working.

Also, how can i change the application so that each time i reload the page to not do the same operations: connect to database, populate the table. Is it a possibility to populate only once the table from the database and then at each refresh to work only with the data from the table?

Hope i made myself clear enough....

jpjones

9:53 am on May 8, 2003 (gmt 0)

10+ Year Member



Anything to cause the browser to refresh must be done on the browser side. There may be a function in C# to automatically output the relevant code, but since I have not programmed in C# yet, I do not know :(

Your best bet is to use a JavaScript function, like your timer function, which counts down a specified time, and then calls the URL again, e.g.

//code to count down here
if (time==0) {
window.location.reload;
}

JP

garann

9:00 pm on May 8, 2003 (gmt 0)

10+ Year Member



If you don't want to query for the data each time you refresh, you could save it in the Session... depending on how much data you have.

duckhunter

3:35 am on May 9, 2003 (gmt 0)

10+ Year Member



You can use a META refresh tag too:
where 30 is in seconds

<meta http-equiv="refresh" content="30">

cmaryus

6:05 am on May 9, 2003 (gmt 0)

10+ Year Member



10x guys

garann: yep, good idea...
but what do you mean if is to much data?
what is the problem if i store too much data in a Session? the application will move slower?

duckhunter

2:29 am on May 10, 2003 (gmt 0)

10+ Year Member



It's mainly scaling of your site that would be in jeopardy. Too many Session variables eat up too much memory on the server when you get more than a few people on the site at the same time.

sharbel

11:39 am on May 10, 2003 (gmt 0)

10+ Year Member



If the queried data doesnt change much, you should also look into caching, with .NET. This will save you a lot of DB calls since it will make the dataset available to everyone without having to call the query, whereas Session will only do this for each user (each user must call the query once).