在 Visual Studio 2008 中,如果您创建一个新的“启用 Ajax 1.0 的 ASP.NET 2.0 Web 应用程序”,并粘贴以下代码:
代码后台
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button runat="server" ID="foo" Text="click me" onclick="foo_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
代码后台
protected void foo_Click(object sender, EventArgs e) {
throw new Exception("hello");
}
然后点击按钮,你会看到一个显示“hello”的JavaScript警告框。如果在创建.NET 3.5 Web应用程序并粘贴相同的代码后,不再显示任何警告框,请问我错过了什么?