【问题标题】:Update panel causes JavaScript error更新面板导致 JavaScript 错误
【发布时间】:2013-09-06 08:09:45
【问题描述】:

我在使用更新面板时在我的 asp.net 应用程序中遇到了这个问题。只有 IE9 和其他浏览器应用程序的错误才能正常工作。出于调试目的并仅在使用更新面板时结束问题,我创建了一个示例 asp.net 网站。

ASPX

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager runat="server" />
            <asp:UpdatePanel runat="server">
                <ContentTemplate>
                    <asp:Button ID="Button1" Text="Click Me" runat="server" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>

当我点击按钮时,我得到以下 JS 错误。

JS错误是

来自 IE 的 F12 开发者工具,

SCRIPT5007: Unable to get value of the property 'tagName': object is null or undefined 
frameTracker.js, line 2 character 395

从 Visual Studio 2012 开始,

但是当我删除更新面板时,JS错误不再。

有解决这个问题的办法吗?

【问题讨论】:

    标签: c# jquery asp.net internet-explorer-9 updatepanel


    【解决方案1】:

    &lt;head&gt;中添加以下行

    <meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" />
    

    <meta http-equiv="X-UA-Compatible" content="IE=9;FF=3;OtherUA=4" />
    

     <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> // is will always be rendered in IE's latest and greatest mode
    

    【讨论】:

    • 对于您的第一个选项,我收到此错误。 static.freetwittube.com/apps/tv-classic/popup-bg.js 0x800a138f 中第 1 行第 68 列未处理的异常 - Microsoft JScript 运行时错误:无法获取属性“postMessage”的值:对象为空或未定义第二个问题中描述的错误来了。跨度>
    • 您确定在添加上述代码后遇到此异常吗??
    • 你应该使用我提供的第一个选项并寻找Unable to get value of the property 'postMessage': object is null or undefined 异常即将到来,因为属性'postMessage'应该在你的代码中的其他地方使用
    • 你可以看到我的代码很简单,我没有使用任何脚本。
    • 非常感谢您的努力。我已经尝试过了,但没有运气。
    猜你喜欢
    • 2014-09-15
    • 1970-01-01
    • 2012-12-02
    • 1970-01-01
    • 1970-01-01
    • 2013-06-12
    • 1970-01-01
    • 2012-04-28
    • 1970-01-01
    相关资源
    最近更新 更多