asp.net - AJAX ScriptManager 导致问题

标签 asp.net ajax updatepanel scriptmanager toolkitscriptmanager

我试图让 ScriptManager 在 .NET 3.5 中工作,但出现 scriptmanager 异常。我刚刚从页面中删除了所有 UpdatePanel,并将所有内容重构到 UserControls 中,因此页面不再像 VB5 应用程序那样编写。 ToolkitScriptManager 位于母版页上,我在有问题的页面上尝试过使用或不使用 ScriptManagerProxy。

我得到一个带有以下错误的堆栈跟踪:

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

堆栈跟踪:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +8690071
   AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) in d:\hg\act\Server\AjaxControlToolkit\ExtenderBase\ScriptObjectBuilder.cs:323
   AjaxControlToolkit.ExtenderControlBase.OnLoad(EventArgs e) in d:\hg\act\Server\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:305
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

我在代码中看不到任何 <%= 标签,我现在感到绝望了。我将如何追踪错误的根源。如有任何帮助,我们将不胜感激。

最佳答案

除了删除和 <%= ..%> ,请确保您没有Response.Write隐藏代码中的任何内容。

关于asp.net - AJAX ScriptManager 导致问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7194794/

相关文章:

html - ASP.NET - 母版页 CSS 显示不正确

javascript - 使用 .promise() 让 Ajax 请求首先启动?

asp.net - 通过 UpdatePanel 异步回发后重新加载外部 javascript

c# - 无法更新第二个更新面板

c# - 构建具有保证消息传递的 SignalR/Knockout 仪表板

c# - Asp.Net Core - 需要从没有依赖注入(inject)生成的实例访问 HttpContext 实例

php - 如何在没有表单的情况下发布到数据库 php mysql html

javascript - 使用谷歌地图javascript api v3的具有独特信息窗口的多个标记

asp.net - 如何检查 UpdatePanel 是否正在回发?

asp.net - .NET CMS 能够添加自定义模块