0
  <asp:Timer runat="server" id="UpdateTimer" interval="1000" ontick="UpdateTimer_Tick" />
  <asp:UpdatePanel runat="server" id="TimedPanel" updatemode="Conditional">
  <Triggers>
  <asp:AsyncPostBackTrigger controlid="UpdateTimer" eventname="Tick" />
  </Triggers>
  <ContentTemplate>
  <asp:Label runat="server" CssClass="h4" id="DateStampLabel" />
  </ContentTemplate>
  </asp:UpdatePanel>

Back End-Code

Private Sub btnStartTimer_Click(sender As Object, e As EventArgs) Handles btnStartTimer.Click
        UpdateTimer.Enabled = True
        If txtStartTime.Text.Length = 0 Then
            txtStartTime.Text = Now.ToLongTimeString
        End If
        'ViewState("Timer") = "Start"
        'ViewState("StartTime") = Now.ToLongTimeString
        If ViewState("Time") Is Nothing Then
            Dim time As DateTime = New DateTime(2015, 1, 1, 0, 0, 0).ToString("H:mm:ss")
            ViewState("Time") = time
        End If


        btnStartTimer.Enabled = False
        btnPauseTimer.Enabled = True
        btnEndTimer.Enabled = True
    End Sub

 Public Sub UpdateTimer_Tick(sender As Object, e As EventArgs) Handles UpdateTimer.Tick

 Dim dt As DateTime
        dt = CType(ViewState("Time"), DateTime)
        dt = dt.AddSeconds(1)
        ViewState("Time") = dt
        DateStampLabel.Text = dt.ToString("H:mm:ss")
End sub

Okay My timer is running smoothly i.e. Start, Stop, Pause, Resume on LOCAL HOST but when i upload it on SERVER timer is not running ... why? Kindly Help me :(

Note: I am using timer as a stop watch. Keep it in mind that it is running on local host

Chris Dunaway
  • 10,974
  • 4
  • 36
  • 48
Waqar Ahmed
  • 203
  • 1
  • 4
  • 17
  • I updated the tags on your question to hopefully get a more relevant audience. If you disagree, feel free to revert. – jdphenix Apr 17 '15 at 05:27
  • 1
    Why do you include c# and vb.net ? Specify the one programming language you are using, makes it easier for us. – DatRid Apr 17 '15 at 05:32
  • `timer is not running` does not help ? Provide details along with back end code. – Mahesh Apr 17 '15 at 05:34
  • Here's the solution http://stackoverflow.com/questions/21797310/asp-net-timer-only-works-in-debug-mode – Waqar Ahmed Apr 17 '15 at 07:41

1 Answers1

0

Just Add an attribute to ToolScriptManager CombineScript="false"

Waqar Ahmed
  • 203
  • 1
  • 4
  • 17