Good morning,
I'm developing a web site with Ajax extension. I'm interesting to understand how Timer_Tick works.
This is my example code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Pagina senza titolo</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="5000">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
On server side I have the following simple code:
Partial Class _Default
Inherits System.Web.UI.Page
Dim i As Integer = 0
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
i = i + 1
System.Diagnostics.Debug.WriteLine("Contatore: " & i)
End Sub
End Class
When I start the web site I read the following lines in the output console:
Contatore: 1
Contatore: 1
Contatore: 1
Contatore: 1
Contatore: 1
Contatore: 1
It seems like everything is executed not just the sub Time1_Tick.
Why Do it happens?
Thank you