C# asp.net 4.0 的 Ajax 扩展错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18132190/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 11:23:50  来源:igfitidea点击:

Error with Ajax Extensions for asp.net 4.0

c#asp.netajax

提问by pStan

I'm trying to get AJAX extensions working on an existing Web Forms Application.

我正在尝试让 AJAX 扩展在现有的 Web 窗体应用程序上工作。

I've added the AjaxControlToolkit using Nuget. As a test I setup a page with a button and added a button confirmation extension.

我已经使用 Nuget 添加了 AjaxControlToolkit。作为测试,我设置了一个带有按钮的页面并添加了一个按钮确认扩展。

I'm getting this error:

我收到此错误:

0x800a138f - JavaScript runtime error: Unable to get property 'UI' of undefined or null reference

0x800a138f - JavaScript 运行时错误:无法获取未定义或空引用的属性“UI”

On the following line in the dynamically created Javascript:

在动态创建的 Javascript 中的以下行:

$create(Sys.Extended.UI.ConfirmButtonBehavior, {"ConfirmText":"Are ya totally sure?","id":"MainContent_Button1_ConfirmButtonExtender"}, null, null, $get("MainContent_Button1"));

I'm guessing that one of the libraries is the wrong version, but don't know how to go about figuring this out. I've tried to update packages using Nuget.

我猜其中一个库是错误的版本,但不知道如何解决这个问题。我尝试使用 Nuget 更新软件包。

Any ideas?

有任何想法吗?

Thanks!

谢谢!

采纳答案by PiLHA

Try to register the AjaxToolkitwith

尝试注册AjaxToolkit

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajaxToolkit:ToolkitScriptManager>

回答by mcolegro

Many of the tutorials for the Ajax Control Toolkit tell you to use the "ScriptManager" from the Ajax Extensions tab. With the latest versions (4.5) you need to use the "ToolkitScriptManager" from the toolkit.

Ajax Control Toolkit 的许多教程都告诉您使用 Ajax Extensions 选项卡中的“ScriptManager”。对于最新版本 (4.5),您需要使用工具包中的“ToolkitScriptManager”。