vb.net ID 为“UpdatePanel1”的控件需要页面上的 ScriptManager
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29561467/
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
The control with ID 'UpdatePanel1' requires a ScriptManager on the page
提问by S Nash
I'm using ASP.NET and testing a update panel. I know it does require a scriptmanager and I looked at all other similar questions in SO but no one answers my case.
我正在使用 ASP.NET 并测试更新面板。我知道它确实需要一个脚本管理器,我在 SO 中查看了所有其他类似的问题,但没有人回答我的情况。
Here is my code:
这是我的代码:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
This is Form A</div>
<asp:ScriptManager ID="aa" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button Text="OK" runat="server"/>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
So As you see I do have a scriptmanager and still getting this error.
所以如您所见,我确实有一个脚本管理器,但仍然收到此错误。
Feedbacks Appreciated.
反馈表示赞赏。
==============================
==============================
None of similar questions is SO answers my question as "I Already do have a ScriptManager" in my code.
没有一个类似的问题在我的代码中回答我的问题,因为“我已经有一个 ScriptManager”。
采纳答案by Seventh Son
Consider ToolKitScriptManager.
考虑 ToolKitScriptManager。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
This is Form A</div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button Text="OK" runat="server"/>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
回答by Tawab Wakil
If you're testing the site on a mobile device (or the device emulator in the Chrome debugger), double-check to ensure it's using the master page you think it's using. If there is a mobile version of the master page in your project, it may be defaulting to that based on the device size detected. Then if that master page is missing the script manager reference, you'll get the error referenced.
如果您在移动设备(或 Chrome 调试器中的设备模拟器)上测试网站,请仔细检查以确保它使用的是您认为正在使用的母版页。如果您的项目中有母版页的移动版本,它可能会根据检测到的设备大小默认为移动版本。然后,如果该母版页缺少脚本管理器引用,您将收到引用的错误。
More generally, add the script manager reference to allmaster pages in your project and see if you still get the error.
更一般地,将脚本管理器引用添加到项目中的所有母版页,看看是否仍然出现错误。

