7

I've made a new project with one page and a reference to AjaxControlToolkit.dll

The calendar extender below doesn't work, what have I done wrong?

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>

    <form id="form1" runat="server">
    <div>    
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <ajaxToolkit:CalendarExtender runat="server" TargetControlID="TextBox1" CssClass="ClassName" Format="MMMM d, yyyy" />
    </div>
    </form>
</body>
</html>
Himanshu
  • 31,810
  • 31
  • 111
  • 133
user23048345
  • 3,033
  • 7
  • 31
  • 31

7 Answers7

21

Try using the ajaxtoolkit ScriptManager instead of the asp one..everything else looks fine

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" > </ajaxToolkit:ToolkitScriptManager>
Ed B
  • 6,028
  • 3
  • 26
  • 35
5

No, Its what ever you set the tagPrefix as, It could be cc1 or asp or ajaxToolkit

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
TRR
  • 1,637
  • 2
  • 26
  • 43
user1429635
  • 51
  • 1
  • 2
5

The above answer is correct; however, it didn't work for me. I tried instead to drag the ToolkitScriptManager into my form, and it was rendered as

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>"<
. It worked for me then. Note that it was "asp.ToolkitScriptManager", not "ajaxToolkit:ToolkitScriptManager". Perhaps this is a change in the version of the Ajax Control Toolkit I am using?
James Carr
  • 139
  • 1
  • 5
2

regarding Ajax Control Toolkit 7.1213.0

Since you are using the ajax control toolkit you will need to use ToolScriptManager instead of just ScriptManager.

Drag and drop ToolScriptManager or just type

<asp:ToolkitScriptManager runat="server"></asp:ToolkitScriptManager>

if not working put this in the begining of web page.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

You can use CalendarExtender right after targeted textbox.

<asp:TextBox runat="server" ID="txtDate1" />
<asp:CalendarExtender ID="txtDate1_CalendarExtender" runat="server" Enabled="True" TargetControlID="txtDate1">
</asp:CalendarExtender>

If these are not working you should edit your Web.config file and add necessary configurations. Add configurations to ajax controls which will need you to refer another tutorial.

Nishantha
  • 6,065
  • 6
  • 33
  • 51
1
<httpHandlers>
                <remove path="*.asmx" verb="*"/>
                <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
                <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
                <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
                <add path="CrystalImageHandler.aspx" verb="GET" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
                <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
            </httpHandlers>
    <system.web></system.web>
1

Since it is already answered, but just to let the developers facing this problem NOW , talking about the version Update October 2015: which is now maintained by DevExpress

I upgraded my VS 2013 Web Forms application project to ajax via Nuget
&
I faced the same problem, Calender control not working, having all the code perfect

So the solution that worked for me was :

1. I did this:

enter image description here

2. I installed it via this New installer

3. I created a New project in my VS 2013

4. Moved my existing code to this project and

it worked !!

plus,
thers is no <ajaxToolkit:ToolkitScriptManager now , you have to Use the standard ScriptManager now

enter image description here

Irf
  • 4,285
  • 3
  • 36
  • 49
0

Sigh... I know this is question was dated, but in case others arrive and these solutions don't solve the problem then here is something to check. We have a legacy web forms app that I spent most of the morning troubleshooting because the calendar extender controls just stopped working on a specific page. There were no patches or service packs that had been run on server/local dev pc and no Ajax assembly version change and no recent change to the page.

It turns out that a register startup script in page load was referring to a JavaScript function that no longer existed in the external js file hence a JavaScript Error on page load stopped the ajax control initialization/functionality. So check your developer tools (Chrome seems the best) for JavaScript errors that may stop other JavaScript initialization scripts from running for calendar extender and similar.

Charles Byrne
  • 834
  • 2
  • 11
  • 20