protected void Page_Load(object sender, EventArgs e) { lbl_Date.Text = DateTime.Now.ToString(); lbl_Date0.Text = DateTime.Now.ToString(); lbl_Date1.Text = DateTime.Now.ToString(); } protected void Timer1_Tick(object sender, EventArgs e) { lbl_Date0.Text = DateTime.Now.ToString(); }
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="lbl_Date" runat="server" Text="Label"> </asp:Label> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <br /> <br /> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" /> <br /> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <asp:Timer ID="Timer1" runat="server" Interval="1000"> </asp:Timer> <br /> <asp:Label ID="lbl_Date0" runat="server" Text="Label"> </asp:Label> </ContentTemplate> </asp:UpdatePanel> <br /> <br /> <asp:UpdatePanel ID="UpdatePanel3" runat="server"> <ContentTemplate> <br /> <asp:Label ID="lbl_Date1" runat="server" Text="Label"> </asp:Label> </ContentTemplate> </asp:UpdatePanel> <br /> </form> </body> </html>
UpdateMode="Conditional"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)