Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

refresh a function without refresh the whole page.

$
0
0

Hi all,

i would like to know is it possible to just refresh a function in every 5 sec but without refresh the whole page?

Becoz i think it's not a good idea to keep my page refresh in every 5 sec. (waste server resources) Please advice. TQ

Below is my coding...

    Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        sendMT() 'my function
        Label1.Text = "Last refreshed at: " & Format(CDate(Now()), "dd-MM-yyyy hh:mm:ss")

    End Sub

<body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server" /><asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="5000"></asp:Timer><asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"><Triggers><asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /></Triggers><ContentTemplate><asp:Label ID="Label1" runat="server" Font-Names="Arial"></asp:Label><br /><br /><asp:Label ID="Label2" runat="server" Font-Names="Arial" Font-Size="Large" ForeColor="Red" Text="This page is running auto script. Please do not close it." Width="300px"></asp:Label></ContentTemplate></asp:UpdatePanel>        </form></body>




Viewing all articles
Browse latest Browse all 5678

Trending Articles