Question

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
Was it helpful?

Solution

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

OTHER TIPS

In a new web application there were more than one to do. In my new vs2013 project I had to

  1. remove not only Microsoft.AspNet.ScriptManager.MSAjax.dll but all reference like Microsoft.AspNet.ScriptManager.*
  2. delete all theses files from the Bin folder
  3. then rebuild the project

May this can help someone ! I misread the above advice (my fault). Remeber to remove all references made from the solution as well.

You may also need to delete the reference to the Microsoft.AspNet.ScriptManager.MSAjax.dll in your project properties. This is what I needed to do to solve the problem.

http://ajaxcontroltoolkit.codeplex.com/workitem/27639

Here is how you install that old version via NuGet on the Package Manager Console command line: Install-Package AjaxControlToolkit -Version 7.607.0

I was experiencing this exact issue with AjaxControlToolkit 7.1213. Reverting to 7.607.0, like mlippold suggested, resolved the problem for me. Thanks!

I only exclude the Microsoft.AspNet.ScriptManager.MSAjax.dll from the bin directory

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top