简体   繁体   English

更新ASP.NET AJAX ControlToolkit后出现Javascript错误

[英]Javascript error after updating ASP.NET AJAX ControlToolkit

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: 我刚刚更新到AJAX控制工具包3.5,在我的母版页中将ScriptManager更改为ToolkitScriptManager,现在单击“编辑”按钮时发生以下javascript错误:

"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 将项目从3.5迁移到4.0 .NET Framework时遇到相同的问题

I saw a very simple solution in this URI: 我在此URI中看到了一个非常简单的解决方案:

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

User comments that _destroyTree method has been deprecated in .NET 4.0+ versions. 用户评论_destroyTree方法已在.NET 4.0+版本中弃用。 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 我最初的猜测是,“ this”是指未实现_destroyTree或_destroyTree不接受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. 请记住,javascript与C#稍有不同,因为“ this”是指执行方法的当前所有者。

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. 我遇到了类似的问题,从ScriptManager到ToolkitScriptManager,虽然它不是一个优雅的解决方案,但对我有用的是删除ScriptManager,重建解决方案(即使它抛出错误),然后在其中添加ToolScriptManager。并重建。

For some reason the project was hanging on to the old object type reference (ScriptManager) and causing problems. 由于某种原因,该项目挂在旧的对象类型引用(ScriptManager)上并引起问题。 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. 直到将其删除并重建(从而从项目中删除该对象的所有实例)并进行添加,然后才设置了所有正确的连接。

我使用了较旧的AJAX ControlToolkit 3.5版本,现在错误已消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM