UpdatePanel1 updates every 3 seconds regardless of conditions inside Timer1_Tick. I wanted to only update if x=1. Further explaining: If I completely remove the line UpdatePanel1.Update() and everything inside Timer1_Tick(), then UpdatePanel1 still updates every 3 seconds. The problem is not with where integer x is declared. I'd expect the problem to be within the ASP code.
<asp:ScriptManager runat="server" id="ScriptManager1" />
<div><asp:Timer runat="server" id="Timer1" Interval="3000" OnTick="Timer1_Tick" /></div>
<asp:UpdatePanel runat="server" id="UpdatePanel1" UpdateMode="Conditional" RenderMode="Block">
<Triggers><asp:AsyncPostBackTrigger ControlID="Timer1" /></Triggers>
<ContentTemplate>
<asp:Label id="Label1" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
And the vb code..
Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
'If x=1 Then
'UpdatePanel1.Update() 'Update only if x=1
'Else
'Do nothing
'End If
'Regardless of what is in this subfunction, nothing or the above, Updatepanel updates every 3 seconds
End Sub
February 4th: UpdatePanel1 is still updating/reloading every 3 seconds nonconditionally. Problem is in the ASP code I believe. Answers or ideas are welcome.