AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts Error

Rafiki picture Rafiki · Oct 15, 2013 · Viewed 21.6k times · Source

I'm experiencing a AjaxToolkit Calendar display error in production only. Locally when debugging, this problem does not exist and the calendar datepicker works perfectly. All of the other posts revolve around this Toolkit not working at all. I'm concerned with why this works in test but not production since I can't find a reference anywhere in my code that uses ASP.NET ScriptManager.

The following is on "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>

This is the page that uses the Calendar function and has Site.Master as its 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>

This is part of my Web.config file

<controls>
    <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />        
    <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
</controls>

This is the error that is generated in production:

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

Answer

Win picture Win · Oct 15, 2013

You might want to try removing Microsoft.AspNet.ScriptManager.MSAjax.dll from bin folder on the server if exists.

AjaxControlToolkit version 7.0123 with .NET 4.5