我试图让 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/