您的位置:首页 > 其它

Updatepanel 中使用 Timer 控件 失去焦点问题

2013-11-05 15:00 453 查看
在Update Panel 中 如果使用timer 定时刷新数据,会造成textbox 或者其他控件的焦点丢失问题。

所以 text box 不能和timer 放在同一个Updatepanel 中。

建议放在2 个不同的UpdatePanel 中,同时设置UpdateMode 为 condition

<asp:UpdatePanel ID="UpdatePanelForQuery" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="TextBoxMachineName" runat="server" CssClass="border" Text=""></asp:TextBox>
</ContentTemplate>

</asp:UpdatePanel>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Timer ID="ClusterRef" Interval="3000" runat="server">
</asp:Timer>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ClusterRef" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>

可以吧后台的方法放在PageLoad中执行。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: