I have the following method:
//BOLO stands for Be On The Lookout
public void LoadBolos()
//If not loaded before
if (ViewState["bolos"] == null)
List<string> bolos = GetBolos();
ViewState["bolos"] = bolos;
ViewState["index"] = 0;
bolos = (List<string>)ViewState["bolos"];
int index = ViewState["index"] != null ? (int)ViewState["index"] : 0;
if (bolos.Count > 0)
imgBolo.ImageUrl = bolos[index];
index = index >= bolos.Count ? 0 : index;
ViewState["index"] = index;
I need to loop this method every 10 seconds, so I can refresh an image on the aspx page. However, I've noticed that some Thread.Timer functions don't allow non-static functions to be used.
If I convert this method to static, I can no longer access private variables that load on page load, nor can I use the Viewstate nor access the image.
So I was wondering which would be the most accurate way to refresh an image on the page every 10 seconds.