asp.net timer viewstate
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Default4 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Timer1_Tick(object sender, EventArgs e) { int ticknum = 0; if (ViewState["count"] != null) { ticknum = (int)ViewState["count"]; } ticknum++; if (ticknum > 10) { Timer1.Enabled = false; } else { ViewState["count"] = ticknum; } } protected void Timer2_Tick(object sender, EventArgs e) { this.Label1.Text = DateTime.Now.ToString(); } }