views:

37

answers:

1

i am displaying time in the label which is inside the grid view. i need to Refresh the label every second. how to do this by Java script.Like Ajax timer.

EDIT:

OnLoad="setTimeout(window.location.reload();. 1000);" whats wrong with this code or <asp:Label ID="Label2" Width="100px" runat="server" OnLoad="setTimeout(window.location.reload();. 1000);" Font-Size="12px" ForeColor="Black" Text='<%# Bind("time") %>'></asp:Label>

A: 
setInterval(function(){
  var now = new Date();
  $('#yourSpanId').text(now.toUTCString()); // or whatever formatting you need
}, 1000);
Jakub Konecki
no i already bind the time using c# code behind..just i need to refresh it so that its look like digital clock..
Ayyappan.Anbalagan
You need to refresh your grid then? Are you using UpdatePanels? Some code sample will be useful... - or just Google for 'Ajax timer'
Jakub Konecki
OnLoad="setTimeout(window.location.reload();. 1000);" whats wrong with this code or <asp:Label ID="Label2" Width="100px" runat="server" OnLoad="setTimeout(window.location.reload();. 1000);" Font-Size="12px" ForeColor="Black" Text='<%# Bind("time") %>'></asp:Label>
Ayyappan.Anbalagan