Hi,
I'm trying to make a simple webpage that will update time every second using the new XmlHttpPanel callback. I'm a noob on Javascript, so I ask for your help.
Here's my markup:
and here's my codebehind:
The time is updated on pagerefresh, but I can't figure out how to make it update automatically every second.
How do I do that and what is the best approach?
Thanks!
Morten
I'm trying to make a simple webpage that will update time every second using the new XmlHttpPanel callback. I'm a noob on Javascript, so I ask for your help.
Here's my markup:
| <script type="text/javascript"> |
| function UpdateTime(sender, args) { |
| var panel = $find("<%=RadXmlHttpPanel1.ClientID%>"); |
| panel.set_value(); |
| window.setInterval(UpdateTime, 1000); |
| } |
| </script> |
| <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"> |
| </telerik:RadAjaxLoadingPanel> |
| <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" |
| Value="test" OnServiceRequest="XmlHttpPanel_ServiceRequest"> |
| <asp:PlaceHolder ID="ph" runat="server"></asp:PlaceHolder> |
| </telerik:RadXmlHttpPanel> |
| <script type="text/javascript"> |
| UpdateTime; |
| </script> |
and here's my codebehind:
| Protected Sub XmlHttpPanel_ServiceRequest(ByVal sender As Object, ByVal e As RadXmlHttpPanelEventArgs) |
| Dim val As String = e.Value |
| ph.Controls.Add(New LiteralControl("<font color='#000000'>" & Now.ToString & "</font>")) |
| End Sub |
The time is updated on pagerefresh, but I can't figure out how to make it update automatically every second.
How do I do that and what is the best approach?
Thanks!
Morten