Code
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate >
<asp:TextBox ID="txtPwd" runat="server" TextMode="Password" Width="200px"></asp:TextBox>
<asp:Label ID="label1" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="提交" onclick="Button1_Click" />
<asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Button1_Click">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate >
<asp:TextBox ID="txtPwd" runat="server" TextMode="Password" Width="200px"></asp:TextBox>
<asp:Label ID="label1" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="提交" onclick="Button1_Click" />
<asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Button1_Click">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
Code
protected void Button1_Click(object sender, EventArgs e)
{
label1.Text = DateTime.Now.Second.ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
label1.Text = DateTime.Now.Second.ToString();
}
Interval:设置时间间隔; ontick:指定触发时执行的事件。