IE中的ASP.NET页在其他程序中时会成为焦点

Mic*_*rst 5 asp.net internet-explorer asp.net-ajax

我有一个很漂亮的问题!

我创建了一个带有updatepanel和该updatepanel上的触发器的ASP.NET页。触发器每30秒更新一次面板。

问题在于,当触发器更新面板时,IE8会从我正在使用的任何其他程序中获取焦点。有人对此有解决方案吗?

这发生在IE8中;在Firefox中,我对此没有任何问题。

这是带有updatepanel的计时器:

<asp:Timer ID="Timer1" runat="server" Interval="30000" ontick="Timer1_Tick">
</asp:Timer>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
    <asp:AsyncPostBackTrigger ControlID="ButtonSubmit" EventName="Click" />
    </Triggers>    
    <ContentTemplate>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
            <ProgressTemplate>
                Loading....
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder><br />
        <div class="clear"></div>
        <asp:Label ID="Label4" runat="server" Text="Grid not refreshed yet.">                    
        </asp:Label><br />
        <asp:Label ID="Label5" runat="server" Text="(Grid Will Referesh after Every 30 Sec)" Font-Bold="true"></asp:Label> 
    </ContentTemplate>   
</asp:UpdatePanel> 
Run Code Online (Sandbox Code Playgroud)

在计时器刻度上,我仅执行以下操作:

protected void Timer1_Tick(object sender, EventArgs e)
{
    Label4.Text = "Grid Refreshed at: " + DateTime.Now.ToLongTimeString();
}
Run Code Online (Sandbox Code Playgroud)

提前致谢。

我希望任何人都知道IE8为什么会“窃取”焦点。

Rav*_*via -1

尝试一下现场活动,这应该可以解决您的问题。http://docs.jquery.com/Events/live