62,074
社区成员
发帖
与我相关
我的任务
分享
<div>
<asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="Button2" runat="server" Text="启动" OnClick="Button2_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick" Enabled="False">
</asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%=DateTime.Now.ToString() %>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
</div>
protected void Timer1_Tick(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
Timer1.Enabled = !Timer1.Enabled;
Button2.Text = Timer1.Enabled ? "停止" : "启动";
}