ajax计时器不需要回发 [英] no postback needed for ajax timer

查看:87
本文介绍了ajax计时器不需要回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:ScriptManager ID="ScriptManager1"  runat="server">
  </asp:ScriptManager>
            <tr>


                <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
                    <Triggers>
                       <asp:AsyncPostBackTrigger  ControlID="timer2" EventName="tick"  />
                    </Triggers>
                    <ContentTemplate><asp:Label runat="server" Text="Label" ID="label1"></asp:Label></ContentTemplate>
                </asp:UpdatePanel>


                <asp:Timer ID="Timer2" runat="server" interval="60000"  Enabled="true"  OnTick="Timer2_Tick" ViewStateMode="Enabled" ValidateRequestMode="Enabled"></asp:Timer>







i将这个编码用于ajax计时器

当我点击导航栏项目计时器应该开始

,它将在两分钟内结束



但当我点击相同的导航栏项目计时器再次启动但我不需要计时器再次启动

i只需要先启动我点击导航栏项




i have used this coding for ajax timer
when i click in navbar item timer should start
and it wil be end in two minutes

but when i click same navbar item timer start again but i dont need timer to start again
i need to start only first i click navbar item

推荐答案

当你点击你说明计时器时。

里面的计时器事件停止计时器通过这种方式完成执行后,你无法调节计时器。



如果你想让你的计时器运行20秒你将有代码执行该操作之后停止禁用计时器的计时器。
When u click ur stating the timer .
inside the timer event stop the timer after the execution is complete by this way u cant regulate the timer.

if u want ur timer to run for 20 sec ull have code to perform that operation after that just stop the timer of disable the timer.


这篇关于ajax计时器不需要回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆