6

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
Win
  • 61,100
  • 13
  • 102
  • 181
Rafiki
  • 630
  • 1
  • 8
  • 22

5 Answers5

18

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

Win
  • 61,100
  • 13
  • 102
  • 181
  • That fixed it. I appreciate your help. I thought I was deleting existing files prior to publishing but I guess not. – Rafiki Oct 15 '13 at 21:55
  • It would appear that installing the toolkit via the package manager (instead of the console) leaves the old file intact - wondered why I didn't get the usual 'MsAjaxBundle is not a valid script name.' issue. That resolved it, my upvote added :-) – gchq Nov 20 '14 at 19:56
  • Microsoft.ScriptManager.MSAjax.dll was causing issue in my case – Arjun Sharma Jan 23 '15 at 09:59
3

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.

DmitryK
  • 5,542
  • 1
  • 22
  • 32
Tchaps
  • 865
  • 7
  • 21
2

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.

Chris Hampton
  • 109
  • 1
  • 9
1

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!

1

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

mxadrian
  • 11
  • 1
  • Isn't this the same as the existing, [accepted answer](http://stackoverflow.com/a/19391784/923794)? – cfi Jun 26 '14 at 15:56