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
Post a Comment