我仅在生产中遇到 AjaxToolkit 日历显示错误。本地调试时,不存在此问题,日历日期选择器工作正常。所有其他帖子都围绕这个工具包根本不起作用。我担心为什么这在测试中有效但在生产中无效,因为我在使用 ASP.NET ScriptManager 的代码中的任何地方都找不到引用。
以下是“Site.Master”
<ajaxToolKit:ToolkitScriptManager runat="server">
<Scripts>
<%--Framework Scripts--%>
<%--<asp:ScriptReference Name="jquery" />--%>
<%--<asp:ScriptReference Name="jquery.ui.combined" />--%>
<asp:ScriptReference Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Path="~/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Name="WebFormsBundle" />
<%--Site Scripts--%>
</Scripts>
</ajaxToolKit:ToolkitScriptManager>
这是使用 Calendar 功能并以 Site.Master 作为其 MasterPageFile 的页面
<asp:Label ID="DateRangeLabel" runat ="server" Text="Date Range: "></asp:Label>
<asp:TextBox ID="DateFrom" runat="server" Width="95px"></asp:TextBox>
<ajaxtoolkit:calendarextender ID="Calendarextender" runat="server" TargetControlID="DateFrom" PopupPosition="BottomLeft" Format="MM/dd/yyyy"></ajaxtoolkit:calendarextender>
<asp:TextBox ID="DateTo" runat="server" Width="95px"></asp:TextBox>
<ajaxtoolkit:calendarextender ID="Calendarextender1" runat="server" TargetControlID="DateTo" PopupPosition="BottomLeft" Format="MM/dd/yyyy"></ajaxtoolkit:calendarextender>
这是我的 Web.config 文件的一部分
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
</controls>
这是生产中产生的错误:
Uncaught Error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.
Uncaught TypeError: undefined is not a function MicrosoftAjax.js:6