“Ajax错误”;Microsoft JScript运行时错误:';ID';是未定义的“;

“Ajax错误”;Microsoft JScript运行时错误:';ID';是未定义的“;,ajax,asp.net-ajax,Ajax,Asp.net Ajax,嗨,我正在尝试使用一个简单的ajax UpdatePanel..但是不断出现错误 “Microsoft JScript运行时错误:'ID'未定义”在我尝试刷新页面时。 谁能帮我一下吗 代码如下:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.

嗨,我正在尝试使用一个简单的ajax UpdatePanel..但是不断出现错误 “Microsoft JScript运行时错误:'ID'未定义”在我尝试刷新页面时。 谁能帮我一下吗

代码如下:-

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Hello, world!</title>
</head>
   <body>
<form id="form1" runat="server">
    <asp:ScriptManager ID="MainScriptManager" runat="server" />
    <asp:UpdatePanel ID="pnlHelloWorld" runat="server">
        <ContentTemplate>
            <asp:Label runat="server" ID="lblHelloWorld" Text="Click the button!" />
            <br /><br />
            <asp:Button runat="server" ID="btnHelloWorld" OnClick="btnHelloWorld_Click" Text="Update label!" />
        </ContentTemplate>
    </asp:UpdatePanel>
</form>
</body>
</html>

你好,世界!



提前感谢。

也有同样的问题,认为这与我下载的3.5版Ajax包有关。
我使用的是win7 x64-IE 8。在我将IE 8更新为IE 9后,问题得到了解决。所以我猜这可能与IE 8有关。

我也有同样的错误,我追踪到了我使用的C类,HTML代码和敲除js。似乎knockout js将javascript viewModel对象链接到HTML页面值和您正在使用的C#class对象。例如:

HTML页面有: 请注意所使用的敲除Id()

C#类必须有对该“Id()”的引用: 公共int Id{get;set;}

这样,当您在javascript中链接两者时: viewModel.urlColumn1ReportArray.push(viewModel.currentReportDataArray()[i].ReportDataList()[0]); Knockout js可以将HTML“Id()”与C#class“Id()”链接起来


很酷吧

代码隐藏文件中有代码吗?