An interesting problem...
-
I've encountered an interesting problem to which I can't seem to find a solution. I've got an ASP.NET application, written in C#, that returns a variable called TimeToRefresh each time that the page loads. This variable is determined dynamically, represents the number of milliseconds before the page needs to automatically refresh, and could be any positive integer. Since I need an automatic page refresh, that necessitates JavaScript (if there's another client-side method for automatic page refresh that could be adapted to this problem, please let me know). I need to implement, therefore, a JavaScript timer that counts down the number of milliseconds indicated in the TimeToRefresh variable. Here's the rub: I can't find a way to transfer the variable from ASP.NET to JavaScript. I need to either: a.) access an ASP control from JavaScript, or b.) populate an html control from ASP that can then be accessed by JavaScript. I can't seem to do either successfully. Any ideas? Another method entirely, perhaps? Thanks for your help!
-
I've encountered an interesting problem to which I can't seem to find a solution. I've got an ASP.NET application, written in C#, that returns a variable called TimeToRefresh each time that the page loads. This variable is determined dynamically, represents the number of milliseconds before the page needs to automatically refresh, and could be any positive integer. Since I need an automatic page refresh, that necessitates JavaScript (if there's another client-side method for automatic page refresh that could be adapted to this problem, please let me know). I need to implement, therefore, a JavaScript timer that counts down the number of milliseconds indicated in the TimeToRefresh variable. Here's the rub: I can't find a way to transfer the variable from ASP.NET to JavaScript. I need to either: a.) access an ASP control from JavaScript, or b.) populate an html control from ASP that can then be accessed by JavaScript. I can't seem to do either successfully. Any ideas? Another method entirely, perhaps? Thanks for your help!
Hi, I think that you can add one server side field to your webform and write into it the interval of refresh then you can access this value from your JavaScript and set one timer function while the page loads , after the interval elapses the page will refresh , you can manipulate the refresh by calling the submit method of the page or you can navigate to the same page. Kareem Shaker