Click to See Complete Forum and Search --> : Display current time inside label


Zouve
December 20th, 2006, 05:32 AM
Can someone tell me how to insert current time inside a label. i wanna to include a timer inside my website.

Shuja Ali
December 20th, 2006, 06:07 AM
Use javascript.
http://www.google.co.in/search?hl=en&q=Javascript+%2B+Clock&meta=

karim_medusa
December 20th, 2006, 07:35 AM
Hi,
i think this code will solve your problem.


<%@ Page Language="C#" %>
<script runat="server">
void Button1_Click(Object sender, EventArgs e)
{
Label1.Text = "Clicked at " + DateTime.Now.ToString();
}
</script>
<html>
<head>
<title>Single-File Page Model</title>
</head>
<body>
<form runat="server">
<div>
<asp:Label id="Label1"
runat="server" Text="Label">
</asp:Label>
<br />
<asp:Button id="Button1"
runat="server"
onclick="Button1_Click"
Text="Button">
</asp:Button>
</div>
</form>
</body>
</html>