0

I have enabled the timer so when It count to 10, button should show up and timer should stop running. It keeps reloading the page every time it increments the count. Is there a quick fix for this? Below is the code. Thank in advance.

public partial class mainUser : System.Web.UI.Page {

private static int c = 0;

protected void Page_Load(object sender, EventArgs e)
{
   lvlTimer.Visible = false;



    Timer1.Enabled = true;

}

protected void btnTakeQuiz_Click(object sender, EventArgs e)
{


}

protected void Timer1_Tick(object sender, EventArgs e)
{
    Timer1.Interval = 1500;
    c = c + 1;
    lvlTimer.Text = c.ToString();
    if (c == 10)
    {
        Timer1.Enabled = false;
        btnTakeQuiz.Visible = true;
    }
}

}

newbie2
  • 25
  • 6
  • Mandatory read for everyone programming in ASP.NET: [ASP.NET Page LifeCycle](https://learn.microsoft.com/en-us/previous-versions/ms178472(v=vs.140)) – Steve Aug 21 '19 at 18:56
  • Also very useful is [What is a PostBack?](https://stackoverflow.com/questions/4251157/what-is-a-postback) – Steve Aug 21 '19 at 19:00
  • @Steve, [ViewState](https://stackoverflow.com/a/53152096/5836671) is also useful in this case. – VDWWD Aug 21 '19 at 19:04

0 Answers0