我希望了解如何在 Ubuntu 16.04 上的网页中呈现 ASP.NET 的脚本管理器,然后呈现 UpdatePanel。
以下 aspx 脚本代码在结合 Xamarin Studio 的 Windows 7 Microsoft Visual Studio 2013 上运行良好。
但是,当我在运行 apache2 和 xsp4 的 Firefox Web 浏览器中请求 URL 127.0.0.1:9000/Tutorial.aspx 时,遇到以下异常。
System.InvalidOperationException ID 为“UpdatePanel1”的控件需要页面上的 ScriptManager。 ScriptManager 必须出现在任何需要它的控件之前。
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Web.Extensions.
Exception stack trace:
at System.Web.UI.UpdatePanel.get_ScriptManager () <0x41cfa1b0 + 0x0015f> in <filename unknown>:0
at System.Web.UI.UpdatePanel.RegisterPanel () <0x41cfa0b0 + 0x000a7> in <filename unknown>:0
at System.Web.UI.UpdatePanel.OnInit (System.EventArgs e) <0x41cfa050 + 0x0001f> in <filename unknown>:0
at System.Web.UI.Control.InitRecursive (System.Web.UI.Control namingContainer) <0x41cf9820 + 0x0013c> in <filename unknown>:0
at System.Web.UI.Control.InitRecursive (System.Web.UI.Control namingContainer) <0x41cf9820 + 0x000a4> in <filename unknown>:0
at System.Web.UI.Control.InitRecursive (System.Web.UI.Control namingContainer) <0x41cf9820 + 0x000a4> in <filename unknown>:0
at System.Web.UI.Page.InternalProcessRequest () <0x41cf82d0 + 0x003e1> in <filename unknown>:0
at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) <0x41cea5e0 + 0x001f3> in <filename unknown>:0
<body>
<form id="form2" runat="server">
<div>
<div class="container">
<div>
<div class="imageFormHead">
<asp:Label runat="server" Text="<%$ Resources:Resource, FT_formTitle %>"></asp:Label>
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager>
</div>
<div>
<asp:ScriptManager ID="ScriptManagerBC" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<cc1:TabContainer id="TabControl" runat="server" activetabindex="0" AutoPostBack="True" OnActiveTabChanged="TabControl_ActiveTabChanged">
</cc1:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>
请提出一个解决方案,使我能够避免上述异常。
我使用了这个网址:https://stackoverflow.com/questions/7525525/how-to-add-an-updatepanel-controls-to-a-page-programmatically我无法以编程方式将更新面板控件添加到我的测试网页。
System.NullReferenceException
Object reference not set to an instance of an object
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Web.Extensions.
Exception stack trace:
at System.Web.Handlers.ScriptResourceHandler.EncryptString (System.String s) <0x418eada0 + 0x00150> in <filename unknown>:0
at System.Web.Handlers.ScriptResourceHandler+RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl (System.Reflection.Assembly assembly, System.String resourceName, System.Globalization.CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) <0x418e70a0 + 0x00617> in <filename unknown>:0
at System.Web.Handlers.ScriptResourceHandler.GetScriptResourceUrl (System.Reflection.Assembly assembly, System.String resourceName, System.Globalization.CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) <0x418e6f40 + 0x00055> in <filename unknown>:0
at System.Web.UI.ScriptReference.GetUrlFromName (System.Web.UI.ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) <0x418e58e0 + 0x000ff> in <filename unknown>:0
at System.Web.UI.ScriptReference.GetUrl (System.Web.UI.ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) <0x418e5680 + 0x0012b> in <filename unknown>:0
at System.Web.UI.ScriptManager.RegisterScripts () <0x418e30f0 + 0x0031b> in <filename unknown>:0
at System.Web.UI.ScriptManager.OnPagePreRenderComplete (System.Object sender, System.EventArgs e) <0x418e2f00 + 0x000ef> in <filename unknown>:0
at System.Web.UI.Page.OnPreRenderComplete (System.EventArgs e) <0x418e2a80 + 0x00090> in <filename unknown>:0
at System.Web.UI.Page.ProcessLoadComplete () <0x418c3ce0 + 0x001e0> in <filename unknown>:0
at System.Web.UI.Page.InternalProcessRequest () <0x41876930 + 0x0049f> in <filename unknown>:0
[编辑 2016 年 6 月 29 日 7:06P.M] 今天晚上我发现我的问题的一个主要原因是我正在混合苹果和橙子。 “苹果”是 Microsoft 的 asp:ScriptManager,“橙子”是 Mono 的 asp:ScriptManager。有谁知道我为什么会收到此错误以及如何修复它?
任何帮助是极大的赞赏。