最近項目中有一個快顯視窗的功能需要實現,查看了一下asp.net ajax感覺在功能上實現起來還是比較簡單的,所以就用了asp.net ajax ajaxcontroltoolkit實現.
在實現過程中出現了三個錯誤,有些鬱悶,但根據尋找原因,終於找到問題所在.
1.ajaxcontroltoolkit中的組件不能添加到頁面中,這是我項目的原因所至,會提示"記憶體錯誤".
處理方法:將ajaxcontroltoolkit.dll檔案先引用到項目中,不是添加到工具箱中,組件就可添加到頁面中.
2.ajaxcontroltoolkit未定義的錯誤.
處理方法:尋找原因是因為Server.Transfer()轉接頁面所至.因為下一頁面中修改,修改會再導接到添加的頁面,所以出現了ajaxcontroltoolkit未定義的錯誤.用Response.Redirect()解決.
3. Sys.未定義的錯誤
處理方法:asp.net中的web.config未配置 <httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>