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中执行。
所以 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中执行。
相关文章推荐
- treeView控件节点被选择后,失去焦点。但是该节点有背景色的问题。
- 安卓使用外接扫码枪扫描一维码之后EditText失去焦点的问题
- 关于Dev控件gridView中内嵌repositoryItemComboBox等控件失去焦点后值消失问题
- 解决使用工具栏组件时控件焦点事件的问题
- Windows 服务中使用 Timer 控件时,Tick 事件不命中问题的解决
- Flex 文本编辑类控件 强制失去焦点问题
- Windows 服务中使用 Timer 控件时,Tick 事件不命中问题的解决
- WPF下 使用它tabcontrol控件 时遇到的指定控件获得焦点的问题
- 使用C#解决部分Win8.1系统窗口每隔几秒失去焦点的问题
- 关于.Net WinForm 中的控件失去焦点时触发事件的问题
- Android 控件添加BadgeView后失去焦点问题
- 关于.Net WinForm 中的控件失去焦点时触发事件的问题
- 用 BindingSource 绑定窗体中控件不失去焦点无法更新数据源的问题
- ie8 下拉菜单使用透明失去焦点问题
- jquery-validate--使用由于疏忽导致的问题1(input失去焦点没有被验证,submit才验证)
- 使用C#解决部分Win8.1系统窗体每隔几秒失去焦点的问题
- UpdatePanel控件使用详解(二)
- 在Fragment控件的匿名内部类中使用运行时权限及相关问题
- java 控件失去或者获取焦点的响应
- 实现页面跳转后,原页面弹窗且不让后页面失去焦点-javascript函数执行顺序问题