About Me

My photo
a Dynamic and Energetic guy.....

Monday, December 7, 2009

Time Update using AJAX Controls

<div>


<cc1:ToolkitScriptManager
ID="ToolkitScriptManager1"
runat="server">

</cc1:ToolkitScriptManager>

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

<ContentTemplate>

 
<asp:Panel
runat="server"
id="TimerArea">

<div
style="width: 100%; height: 100%; vertical-align: middle; text-align: center;">

<p>Current Time using AJAX control:</p>

<span
id="currentTime"
runat="server"
style="font-size:xx-large;font-weight:bold;line-height:40px;"/>

</div>

</asp:Panel>


<cc1:AlwaysVisibleControlExtender
ID="UpdatePanel1_AlwaysVisibleControlExtender"

runat="server"
Enabled="True"
TargetControlID="TimerArea">

</cc1:AlwaysVisibleControlExtender>


</ContentTemplate>

</asp:UpdatePanel>

 
<script
type="text/javascript"
language="javascript">

function updateTime()
{

var label = document.getElementById('currentTime');

if (label) {

var time = (new Date()).localeFormat("T");
label.innerHTML = time;
}
}
updateTime();
window.setInterval(updateTime, 1000);

</script>



</div>

No comments:

My Masters