Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 03, 2012 07:21 AM by Primillo
Mar 02, 2012 05:57 PM|LINK
I have a timer and and updatepanel on a page. A user enters some data and clicks a button to activate the timer. I have set the timer tick interval to 1000 (1 second). On the timer tick event (vb.net codebehine) I have an Insert into my DB that happends
if a response is received from another process. My issue is the the insert into the DB is sometimes being repeated. In my timer tick event code I have set the timer.enabled to false, so it will not tick again.
Is it possible that the timer.enabled property is not getting set to false before another tick happens?
Any suggestions are appreciated!
Sample of timer and updatepanel markup
<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="1000" Enabled="false">
<asp:UpdatePanel ID="UpdatePanel3" UpdateMode="Conditional" runat="server">
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
<asp:Label ID="lblResponse" runat="server" Text=""></asp:Label>
Sample of code
'check if we have received a response from the server.
If stuff.CheckResponse() Then
If stuff.ResponseCode = "000" Then
'Turn off timer so it will not tick again
Timer1.Enabled = False
'Do Insert into DB
Mar 03, 2012 07:21 AM|LINK
You may check if the record exist in the database, if exist then don't do the insert