Abhishek Kumar Ravi

Abhishek Kumar Ravi

  • NA
  • 11.5k
  • 4.4m

ASP.NET: How can i add a Timer Control for 60seconds

Aug 4 2014 6:47 AM
What i Want:  I have a page, where i want TIMER type control on the top which ticks for 60 seconds and, then it Redirect to new page after the completion.
 Till now, i have :
In .ASPX page,
<asp:Label ID="timer" runat="server" Font-Bold="True" Font-Names="Segoe UI" Font-Size="50px" ForeColor="Gray" Text="00:60"></asp:Label>
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="5000">
</asp:Timer>
And, in C# back-end code :
int counter = 60; 
protected void Timer1_Tick(object sender, EventArgs e)
{

if(counter!=0)
{
counter--;
timer.Text = "00:" + counter.ToString();
}


Answers (6)