Mafullah Backtrack Mafullah Backtrack - 6 months ago 15
Ajax Question

Timer_Tick is not a member of an aspx page

I have a

Timer
control and
UpdatePanel
for recheck on some several time. but my problem is why
Timer_Tick
is detected with not a member for my aspx page error message,
Here my code

<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Timer1_Tick" />
</Triggers>
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="60"></asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>


And here my problem,

enter image description here

Here my code behind :

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If UUID <> "" Then

If UUID = Cardode Then
scnRFID.Text = CardIdent
Timer1.Enabled = False
Else
Timer1.Enabled = false

End If

End If

End Sub

Answer

Your problem is that Timer1_Tick is private. Internally .aspx file is represented by a class that inherits from code behind class, so private methods are not visible for it.

Make it protected and everything should work fine

Comments