3

我想獲得一個ScriptManager在.NET 3.5中工作,但得到一個scriptmanager異常。我剛剛從頁面中刪除了所有UpdatePanel,並將所有內容重構爲UserControls,因此該頁面不再像VB5應用程序那樣書寫。 ToolkitScriptManager位於主頁上,並且我在有問題的頁面上嘗試了使用和不使用ScriptManagerProxy。AJAX SciptManager導致問題

我出現以下錯誤堆棧跟蹤:

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 

我看不到代碼中的任何<%=標籤和我得到現在絕望了。我將如何去跟蹤錯誤的來源。任何幫助表示讚賞。

+1

[「Controls集合無法修改,因爲該控件包含代碼塊」](http://stackoverflow.com/questions/778952/the-controls-collection-cannot-be-modified-because-the -control-contains-code-blo) – Mrchief

回答

0

除了刪除和<%= ..%>,請確保你沒有Response.Write代碼隱藏任何東西。

+0

謝謝。我沒有檢查<%=,我沒有使用Response.Write()。 – Echilon

+0

這不是我的問題的原因。最近我一直在將.NET 3.5 Web應用程序轉換爲4.0,並且我已經在此特定站點上保留了3.5版本的Ajax Toolkit。 – Echilon