How to use Threading.Timer for a loop on a public non-static method on ASP.NET C#? -


i have following method:

//bolo stands on lookout  public void loadbolos() {     list<string> bolos;      //if not loaded before     if (viewstate["bolos"] == null)     {         list<string> bolos = getbolos();          viewstate["bolos"] = bolos;         viewstate["index"] = 0;     }      else     {         bolos = (list<string>)viewstate["bolos"];     }      int index = viewstate["index"] != null ? (int)viewstate["index"] : 0;      if (bolos.count > 0)     {         imgbolo.imageurl = bolos[index];         index++;         index = index >= bolos.count ? 0 : index;     }      viewstate["index"] = index; } 

i need loop method every 10 seconds, can refresh image on aspx page. however, i've noticed thread.timer functions don't allow non-static functions used.

if convert method static, can no longer access private variables load on page load, nor can use viewstate nor access image.

so wondering accurate way refresh image on page every 10 seconds.

you can refresh page using html content using untitled page

<meta http-equiv="refresh" content="20"  /> 


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -