您的位置:首页 > 编程语言 > ASP

asp.net页面时间实时更新—UpdatePanel的应用

2012-01-28 08:18 447 查看
<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>



<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

<ContentTemplate>

<asp:Label ID="lblTime" runat="server" Text=""></asp:Label>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />

</Triggers>

</asp:UpdatePanel>



<asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick" Interval="1000">

</asp:Timer>



protected void Timer1_Tick(object sender, EventArgs e)

{

this.lblTime.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: