faesel

faesel

  • NA
  • 4
  • 0

Problems updating contents on web form

Jan 23 2008 8:54 AM
Hi,

I am having problems updating things like labels and pictures on a web form, I have successfully managed to update variables in the code behind the web page but none of these changes are seen on the browser. I have tried updating the browser using <meta http-equiv="Refresh" content="10"> but still no changes are seen. I have noted that when using buttons everything is updated correctly, I am not sure what its doing to work correctly.

Please take a look at a outline of what I have done so far:


public partial class MemberPages_Game : System.Web.UI.Page
{
    private static Timer clock;
    private static int test;

    protected void Page_Load(object sender, EventArgs e)
    {
        if(IsPostBack != true)
        {
            clock = new Timer(10000);
            clock.Enabled = true;
            clock.Elapsed += new ElapsedEventHandler(CallUpdate);
        }
    }

    public void CallUpdate(object source, ElapsedEventArgs e)
    {
        test = test +1; //This updates correctly
        conformationLabel.Text = Convert.ToString(test); //The changes for this label not see on the web form.
    }
}