title: Button border is still blue when clicked and timer refreshed ASP .NET
body: <p>I've got button array and every border color signalize some state (<strong>blue = active button; green = normal button, red = "fire"</strong>). Every button represents one sensor on hardware. </p>
  
  <p>Buttons are inside some UpdatePanel which has got Timer inside set on <strong>1500ms</strong> refresh. When the timer is timed out and is called Tick event the page load event is called where i set colors to buttons, so button which is on fire is set red, button which is normal is green and button which is active is blue. Everything is fine until i click on some button which call click event where the clicked button border is changed to blue. I thought that when the Tick event is called now, this clicked button should now loose blue border color and it's set to default green. But it stays blue and even if i set it to the fire(so after next Tick event it should be red) it stays blue. Can someone help to solve this issue?</p>
  
  <pre><code> protected void Page_Load(object sender, EventArgs e)
      {
          //Here is condition which checks if is exist Session['ActiveSensor']
          if (Session["ActiveSensor"] == null)
          {
              Session.Add("ActiveSensor", "A1");
              Session.Add("LastActiveSensorIndex", "0");
          }
          //==================================================================
          Sensors = new SensorNetwork();
          sensor_buttons = new Button[Sensors.SensorNet.Length];
          int i = 0;
          foreach (Sensor sensor in Sensors.SensorNet)
          {
             sensor_buttons[i] = new Button();
              sensor_buttons[i].ID = Convert.ToString(i); 
              sensor_buttons[i].BackColor = sensor.Temperature.TemperatureColor;
              sensor_buttons[i].Text = Math.Round(sensor.Temperature.CelsiusTemperature, 2).ToString() + "°C";
              sensor_buttons[i].Click += new EventHandler(sensor_Click);
              sensor_buttons[i].BorderWidth=2;
  
              if (sensor.Valid == false)
              {
                  sensor_buttons[i].Enabled = false;
              }
              else {
                  sensor_buttons[i].Enabled = true;
              }
              if (sensor.Fire == true)
              {
                  sensor_buttons[i].BorderColor = System.Drawing.Color.DarkRed;
              }
              else {
                  sensor_buttons[i].BorderColor = System.Drawing.Color.ForestGreen;
              }
  
              if (sensor.SensorID == Session["ActiveSensor"].ToString() &amp;&amp; sensor.Fire==false) {
                  sensor_buttons[i].BorderColor = System.Drawing.Color.LightSkyBlue;
                  Session.Add("LastActiveSensorIndex", i.ToString());   
              }
  
              UpdatePanel2.ContentTemplateContainer.Controls.Add(sensor_buttons[i]);
              i++;
          }
      }
  
  
  
  protected void sensor_Click(object sender, EventArgs e)
      {
          var ClickedButton =(Button)sender;
          Sensor NewSensor=Sensors.SensorNet[Convert.ToInt32(ClickedButton.ID)];
  
          ClickedButton.BorderColor = System.Drawing.Color.LightSkyBlue; //This button stays blue even if the Tick is called
       }
  </code></pre>