0
我想运行timer_Tick事件按钮单击并停止计时器按另一个按钮。这是我的代码asp.net按钮点击计时器不启动
protected void Button1_Click(object sender, EventArgs e)
{
Timer1.Enabled = true;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label2.Text = "Timer started";
//string png = IpAddress.Text.ToString(); //"192.168.153.12";//
if (IpAddress.Text == "" || IpAddress.Text == null)
{
Response.Write("Error");
}
else
{
ping1(IpAddress.Text);
ping2(Ipaddres1.Text);
}
}
增加其间隔可能会触发Tick事件像** Timer1.Interval = 1000上buttion点击间隔**。 –