c# - Timer in asp.net works perfectly in localhost but not online -
timer in asp.net works when run application in localhost , when upload , check online timer don't work.
i have condition when user click on "request item" button, in label message should show "submitted successfully" else "some error message". so, did was, created update panel , inside placed submit button 2 labels 1 successful message , error message. , timer control, i've setted 2 seconds in order show message 2 seconds , hide them.
here sorce code:
<asp:updatepanel id="updatepanel2" runat="server"> <contenttemplate> <asp:button id="btnadd" runat="server" text="request item" width="128px" onclick="btnadd_click1" height="38px" /> <asp:label id="lblsuccess" runat="server" font-bold="true" forecolor="#00cc00"></asp:label> <asp:label id="lblerrormessage" runat="server" font-bold="true" forecolor="red"></asp:label> <br /> <asp:timer id="timer1" runat="server" interval="1000" ontick="timer1_tick1" enabled="false"> </asp:timer> </contenttemplate> </asp:updatepanel>
below code timer control triggered under "request item" button.
lblsuccess.visible = true; lblsuccess.text = "records saved!"; timer1.enabled = true;
below code under timer tick event.
protected void timer1_tick1(object sender, eventargs e) { txtcount.text = txtcount.text + 1; if (txtcount.text == "11") //here "11" counted each timer tick. 1 1 timer tick { lblsuccess.visible = false; lblerrormessage.visible = false; timer1.enabled = false; txtcount.text = ""; } }
if using toolscriptmanager
try add attribute combinescript="false"
in , try..
Comments
Post a Comment