title: Parallel processing of Timer Tick event with main thread in asp.net c#
body: <p>I have this function in which i am trying to call timer event as separate thread, but when i click any button in the page or do any thing in the asp.net page then the timer stop for a sec .</p>
  
  <p>Please help how to run it paralley without the effect of another control in page, as the timer should be running every sec and it should not stop in ui.</p>
  
  <pre><code>Thread obj = new Thread(new ThreadStart(timer));
  obj.Start();
  obj.IsBackground = true;
  
  protected void timer()
  {
      Timer1.Interval = 1000;
      Timer1.Tick += new EventHandler&lt;EventArgs&gt;(Timer1_Tick);
      Timer1.Enabled = true;
  }
  
  public void TimerProc(object state)
          {
              fromTime = DateTime.Parse(FromTimeTextBox1.Text);
              tillTime = DateTime.Parse(TillTimeTextBox1.Text);
              DateTime currDateTime = System.DateTime.Now;
              TimeSpan interval = tillTime - currDateTime;
              if (tillTime &lt;= currDateTime)
              {
                  ExamOverPanel1.Visible = true;
                  QuestionPanel.Visible = false;
                  ListBox2.Visible = false;
                  StatusPanel1.Visible = false;
                  VisitLaterLabel.Visible = false;
              }
              else
              {
                  minLabel.Text = string.Format("{0:00}:{1:00}:{2:00}", (int)interval.TotalHours, interval.Minutes, interval.Seconds);
              }
          }
  </code></pre>