开发者

Javascript error after updating ASP.NET AJAX ControlToolkit

开发者 https://www.devze.com 2022-12-30 02:38 出处:网络
I\'ve just updated to 开发者_开发技巧the AJAX Control Toolkit 3.5, changed the ScriptManager to the ToolkitScriptManager in my master page and now the following javascript error occurs when an Edit bu

I've just updated to 开发者_开发技巧the AJAX Control Toolkit 3.5, changed the ScriptManager to the ToolkitScriptManager in my master page and now the following javascript error occurs when an Edit button is clicked:

"Object doesn't support this property or method"

The line of code cuasing the error is:

this._destroyTree(updatePanelElement);

Any initial ideas before I post masses of code?


I had the same problem while I was migrating my project from 3.5 to 4.0 .NET Framework

I saw a very simple solution in this URI:

http://updatepanelshrinker.codeplex.com/discussions/397223

User comments that _destroyTree method has been deprecated in .NET 4.0+ versions. The new function to use is:

//var prm = Sys.WebForms.PageRequestManager.getInstance();
//prm._destroyTree(object);
Sys.Application.disposeElement(object, true);

Regards!


My initial guess is that "this" is referring to something that doesn't implement _destroyTree, or _destroyTree doesn't accept a parameter of type updatePanelElement

Keep in mind that javascript is a little different than C# in the fact that "this" refers to the current owner of the exectuing method.


I've run into similar issues going from ScriptManager to ToolkitScriptManager and while it isn't an elegant solution, the thing that has worked for me is to remove the ScriptManager, rebuild the solution (even if it throws errors) then add the ToolScriptManager in and rebuild.

For some reason the project was hanging on to the old object type reference (ScriptManager) and causing problems. It wasn't until it was removed and rebuilt (thus removing all instances of the object from the project) and added in that all the proper connections were set.


I used a slightly older version of AJAX ControlToolkit 3.5 and the errors have now gone.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号