(100分求高手)TimerControl不能放在UpdatePanel里?
前台:
<atlas:TimerControl runat= "server " ID= "tc " Interval= "1000 " OnTick= "tc_Tick ">
</atlas:TimerControl>
<atlas:UpdatePanel runat= "server " ID= "up1 ">
<ContentTemplate>
<asp:LinkButton runat= "server " ID= "btnStop " Text= "Stop " OnClick= "btnStop_Click "> </asp:LinkButton>
</ContentTemplate>
</atlas:UpdatePanel>
后台:
protected void btnStop_Click(object sender, EventArgs e)
{
tc.Enabled = false;
}
这样不能使TimerControl停止,是很正常的,因为TimerControl没有在UpdatePanel里面。
但是我把TimerControl放在UpdatePanel里面的话,每回调一次,Tick()事件会递增一次执行。如:第一回调后,Tick()事件会执行两次,第二回调后,Tick()事件执行三次......会出现这种情况。
现在的问题是:
1.如何让UpdatePanel里的按钮控制一个TimerControl(可以在UpdatePanel里面或外面)?
2.放在UpdatePanel的TimerControl能不能正常工作?
=========================================================
------解决方案--------------------帮你写了页面试了试
aspx:
<atlas:ScriptManager ID= "ScriptManager1 " runat= "server " />
<div>
<atlas:TimerControl ID= "tc " runat= "server " Interval = "5000 " OnTick= "tc_Tick ">
</atlas:TimerControl>
</div>
<atlas:UpdatePanel ID= "UpdatePanel1 " runat= "server ">
<Triggers>
<atlas:ControlEventTrigger ControlID= "tc " EventName= "Tick " />
</Triggers>
<ContentTemplate>
gggggg <br />
hhhhhh <asp:LinkButton ID= "LinkButton1 " runat= "server " OnClick= "LinkButton1_Click "> LinkButton </asp:LinkButton>
</ContentTemplate>
</atlas:UpdatePanel>
aspx.cs
protected void LinkButton1_Click(object sender, EventArgs e)
{
tc.Enabled = false;
}
protected void tc_Tick(object sender, EventArgs e)
{
}
------解决方案--------------------有可能是CTP特有的问题,先升级到最新的RC版吧。