简体   繁体   中英

How to properly use start and stop timer on ASP.net?

I am having problems on using a timer on ASP.Net I am unable to start the timer after stopping it.

I am calling the functions from code behind using

ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyFun1", "startTimer();", true);

Gives me this error. Screenshot below..

在此处输入图片说明

My main problem is that I need to used the timer like this.. Do something > Start time > Do something on Tick + Stop time > Do something > Start time But I can't because I cannot restart the timer when I stopped it.

<asp:Timer ID="tmrMain" runat="server" Interval="1000" EnableViewState="False"></asp:Timer>

Because $ is Jquery Object, find is method.

So you might use dot to call method

$.find('tmrMain');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM