Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. An interesting problem...

An interesting problem...

Scheduled Pinned Locked Moved ASP.NET
csharphelpjavascripthtmlasp-net
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tantiboh
    wrote on last edited by
    #1

    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!

    K 1 Reply Last reply
    0
    • T tantiboh

      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!

      K Offline
      K Offline
      Kareem Shaker
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups